darkmattercoder/qt-build

[qt-build:5.15.1] Could not find the Qt platform plugin "xcb" in ""

aseifert opened this issue · 10 comments

Hello,

First off, thank you very much for this project, installing Qt inside Docker is a real pain!

Now I successfully compiled a Qt program with your build container, but when I tried to start it, I got the following message:

##W: Could not find the Qt platform plugin "xcb" in ""
##F: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: linuxfb, minimal, offscreen, vnc, webgl.

I saw that you recently closed #15, but I'm not sure if it's really fixed. I did find a libqxcb.so in /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms but if I add that plugin dir to the QT_QPA_PLATFORM_PLUGIN_PATH I get another error:

##W: QLibraryPrivate::loadPlugin failed on "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so" : "Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so: (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)"
Could not load the Qt platform plugin "xcb" in "/usr/lib/x86_64-linux-gnu/qt5/plugins" even though it was found.
##F: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, webgl.

I'm not sure what to do at this point … Can you confirm that the xcb platform plugin is actually working? If so, do you maybe have an idea what I'm doing wrong?

Thank you very much!
Alex

First of all, you try to execute the application on your own system, not inside of my container, correct?

Can you please have a look at the output when invoked with QT_DEBUG_PLUGINS=1 path/to/your/application and provide it?
Also, check wether QT_PLUGIN_PATH is pointing to your /usr/lib/x86_64-linux-gnu/qt5/plugins directory.

What I also found is this: https://stackoverflow.com/questions/17106315/

I will try to help you with this, however my experience regarding what that xcb stuff even is all about, is limited ;-)

No, inside your container. If I set up darkmattercoder/qt-build:5.15.1 like this

sudo apt-get update && sudo apt-get install libqt5charts5-dev libpoppler-qt5-dev --no-install-recommends
export QT_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins
export QT_DEBUG_PLUGINS=1

then when I run ./mytool I get:

##W: QLibraryPrivate::loadPlugin failed on "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so" : "Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so: (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)"
Could not load the Qt platform plugin "xcb" in "" even though it was found.
##F: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, webgl.
 ((null):0, (null))

If I also set export QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt5/plugins then I get:

##W: QLibraryPrivate::loadPlugin failed on "/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so" : "Cannot load library /usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/libqxcb.so: (/usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5: symbol _ZN11QFontEngine14bitmapForGlyphEj6QFixedRK10QTransform version Qt_5_PRIVATE_API not defined in file libQt5Gui.so.5 with link time reference)"
Could not load the Qt platform plugin "xcb" in "/usr/lib/x86_64-linux-gnu/qt5/plugins" even though it was found.
##F: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs (from /usr/lib/x86_64-linux-gnu/qt5/plugins), linuxfb (from /usr/lib/x86_64-linux-gnu/qt5/plugins), minimal (from /usr/lib/x86_64-linux-gnu/qt5/plugins), minimalegl (from /usr/lib/x86_64-linux-gnu/qt5/plugins), offscreen (from /usr/lib/x86_64-linux-gnu/qt5/plugins), vnc (from /usr/lib/x86_64-linux-gnu/qt5/plugins), xcb (from /usr/lib/x86_64-linux-gnu/qt5/plugins), eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb, webgl.
 ((null):0, (null))

Ahhh, wait. I think I see the problem now.You install the qt5 packages from the ubuntu repos. Hence also the path difference that I first did not understand. The qt version I build resides in /usr/local.

So you should set the path: export QT_PLUGIN_PATH=/usr/local/plugins
With your apt install calls, you are installing qt5 stuff from the ubuntu repos. That way, you will have headers that do not belong to the qt version the container is using. This might lead to problems. Might, not have to. I would suggest using the sources that match the qt version though.

I also am curious. If you need that xcb stuff to run your app. Doesn't that mean it has a gui? Then, even when the plugins are found and correctly loaded, you will still not be able to connect to the display and the application won't start, or am I wrong?

The container design is actually not really meant to run applications after they are built, even if that does work for non-gui applications.

@aseifert was this helpful? Do you need further assistance?

hey @darkmattercoder! sorry, I am planning to look into it again very soon, I just haven't come around to it. For now I managed building everything with the rabits/qt:5.15-desktop base image from https://github.com/rabits/dockerfiles. I will see if I can get it to work with your image too.

For making the GUI stuff work I use this approach https://cntnr.io/running-guis-with-docker-on-mac-os-x-a14df6a76efc , you could also use a vnc as done here https://github.com/theasp/docker-novnc

Okay, I set up a quick test and saw you are indeed right. The xcb plugin is not there inside the containers built with my image. I will have to fix this for good and need to add a test.

I confirm the xcb plugin is now successfully built, installed and graphical applications are executable from within the containers.

However, it will land in dockerhub sequentially over the next hours, starting with the most recent QT versions, because the build pipeline needs to finish properly. This issue should then be closed automatically.

Very cool, @darkmattercoder ! Thank you so much for looking into it!