Problem starting Qt/QML app in docker container based on torizon/arm64v8-debian-qt5-wayland-vivante:buster

Hello,
I am runing Torizon OS on verdin-imx8mm module-06612173
linux aarch64 TorizonCore 5.1.0-devel-20201130+build.139(dunfell)
It runs torizon_weston_1 container, based on torizon/weston-vivante image.
I am trying to start a basic “Hello World” Qt/QML application, which is compiled using VSCode( installed Torizon Extensions for VSCode ).
Please find attached the Dockerfile, I am using to build the image - helloqtimg.

Bellow is the command I am using to run a container helloqtcont and the error output I am getting.

verdin-imx8mm-06612173:~$ docker run --rm -it --privileged -v /tmp:/tmp -v /dev:/dev -v /run/udev:/run/udev --name helloqtcont helloqtimg
Using Wayland-EGL
Using the 'xdg-shell-v6' shell integration
QWaylandGLContext: failed to create EGLContext, error=3003
Failed to create EGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::SwapBehavior(DoubleBuffer), swapInterval 1, colorSpace QSurfaceFormat::ColorSpace(DefaultColorSpace), profile  QSurfaceFormat::OpenGLContextProfile(NoProfile)) 
Aborted

I am tasked to port a Qt/QML application to Toradex module, but having problem with starting a simple app.
Could you please help to fix the problem?

Greetings @pazko,

My initial assumption here would be to try the “bullseye” version of the base container image instead of “buster”. I believe we made some changes/fixes so that bullseye is expected to run better with 5.0.

Also did you mistakenly forget to attach your Dockerfile? I was gonna take a closer look but I can’t find your Dockerfile source.

Best Regards,
Jeremias

Apologies I wasn’t super clear in my original comment.

So we use started using a slightly different naming convention with our containers recently. Short story you want this as your base container: https://hub.docker.com/r/torizon/qt5-wayland-vivante

The tagging seems a bit arbitrary but basically 1.X is buster and 2.X is bullseye. More information in this article: https://developer.toradex.com/knowledge-base/container-tags-and-versioning

Best Regards,
Jeremias

Hi Jeremias,
Uploading files fails on my site, but here is the content of Dockerfile:

################## Dockerfile #################################################
FROM torizon/arm64v8-debian-qt5-wayland-vivante:buster
# Make sure we don't get notifications we can't answer during building.
ENV DEBIAN_FRONTEND="noninteractive"
# commands that should be run before installing packages (ex: to add a feed or keys)
# your regular RUN statements here
# Install required packages
RUN if [ ! -z "qml-module-qtquick2-vivante qml-module-qtquick-window2-vivante" ]; then \
    apt-get -q -y update \
    && apt-get -q -y install qml-module-qtquick2-vivante qml-module-qtquick-window2-vivante \
    libqt5gui5-vivante \
    libqt5widgets5-vivante \
    && rm -rf /var/lib/apt/lists/* ; \
    fi
# commands that should be run after all packages have been installed (RUN/COPY/ADD)
COPY work/MyQtVSCode /MyQtVSCode
USER torizon
WORKDIR /MyQtVSCode
# commands that will run on the target (ENTRYPOINT or CMD)
CMD /MyQtVSCode/MyQtVSCode
################################## End of Dockerfile ########################

I tried with bullseye as suggested by modifying FROM torizon/arm64v8-debian-qt5-wayland-vivante:bullseye

but got following error:
Step 1/7 : FROM torizon/arm64v8-debian-qt5-wayland-vivante:bullseye
manifest for torizon/arm64v8-debian-qt5-wayland-vivante:bullseye not found: manifest unknown: manifest unknown

Best Regards,
pazko

Hi Jeremias,
I tried with torizon/qt5-wayland-vivante:2.3
but got following error:

####################### Error building docker ############################
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libqt5core5a-vivante : Depends: libdouble-conversion1 (>= 2.0.0) but it is not installable
                        Depends: libicu63 (>= 63.1-1~) but it is not installable
 libqt5quick5-gles : Conflicts: libqt5quick5
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
The command '/bin/sh -c if [ ! -z "qml-module-qtquick2-vivante qml-module-qtquick-window2-vivante" ]; then     apt-get -q -y update     && apt-get -q -y install qml-module-qtquick2-vivante qml-module-qtquick-window2-vivante     libqt5gui5-vivante     libqt5widgets5-vivante     && rm -rf /var/lib/apt/lists/* ;     fi' returned a non-zero code: 100
##################### End Error Building docker #############################

I tried with 2.2; 2 but all resulted with same error

Best Regards,
pazko

Hi @pazko,

This happened after you followed our tutorials for Qt development with Torizon?

Please have a look at this one:
Qt Debian Container for Torizon - You’ll see that the “full” command to start a container with Qt for Verdin is something like this:

docker run -e ACCEPT_FSL_EULA=1 --rm -it --name=qt5 \
       -v /tmp:/tmp \
       -v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore \
       --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
       torizon/qt5-wayland-examples-vivante:$CT_TAG_QT5_WAYLAND_EXAMPLES_VIVANTE \
       bash

Being " torizon/qt5-wayland-examples-vivante:$CT_TAG_QT5_WAYLAND_EXAMPLES_VIVANTE " your container.

You can of course change the way it will execute (-it, bash, etc). But the mention of the /dev/dri and cgroup are normally necessary for any graphical applications on iMX8.

About your dockerfile, I suggest you take as reference our sample for Python with Qt in GitHub.

Best regards,
André Curvello

Hello Andre,
I based my image on torizon/qt5-wayland-examples-vivante:$CT_TAG_QT5_WAYLAND_EXAMPLES_VIVANTE
and added my application.
With the resulting image and the same options as in your example I was able to start the container successfuly!

Thanks you,

Hi @pazko,

That is what I say #gratitude.

Best regards,
André Curvello