qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in ""
-
I am stuck with the well-known error qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" when i try to run the designer.
Previously i built Qt 5.12.9 and it worked.
Now i want to upgrade to Qt 5.15.2.
I use the opensource license. Therefore more recent versions are not an option.I used export QT_DEBUG_PLUGINS=1 to figure out some details. It tells me that it is looking in "<PathToQT>/plugins/platforms".
With 5.15 the -qt-xcb option was dropped (reference: https://doc.qt.io/qt-5/linux-requirements.html) therefore not finding the xcb plugin there is working as intended.
Instead the libxcb that is installed on the system must be used.I decided to use the build option -bundled-xcb-xinput to avoid further dependencies (https://doc.qt.io/qt-5/linux-requirements.html)
(I tried -no-bundled-xcb-xinput too, just in case i missed something.)Executing ldd ./designer i can see that it is linked to libxcb.so.1 in /usr/lib/x86_64-linux-gnu/. This seems to be fine, as it is the only place on my system where this library can be found. (Other things look good too.)
This thread descripes options how to tell Qt where to look for plugins: https://forum.qt.io/topic/111553/solved-qt-qpa-plugin-could-not-find-the-qt-platform-plugin-xcb-in/2
I used the -platformpluginpath option to tell the designer about that path. Executing the designer with that option (and export QT_DEBUG_PLUGINS=1 still active) gives me among other things this output:QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/libxcb.so"
"Failed to extract plugin meta data from '/usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0'"
not a plugin
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/x86_64-linux-gnu/libxcb.so.1"
"Failed to extract plugin meta data from '/usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0'"
not a pluginSo .. Qt is linked against the libxcb installed on the system as it is supposed to be with 5.15. I am able to tell the designer where it needs to look for that file. But it is not recognised as a plugin. I have no idea where i could continue. What is missing?
I am using Ubuntu 18.04.
-
Hi, there are differences between libxcb.so and libqxcb.so:
the 1st one (libxcb.so) is loaded by Ubuntu (and can be checked using the ldd command)
the 2nd one (libqxcb.so) is a Qt plugin and it is loaded by Qt (not Ubuntu) usually in main.cpp, inside the QApplication a(argc,argv); statement i.e. after your Qt app has been started. This cannot be checked through the ldd command, instead you can use the QT_DEBUG_PLUGINS=1 setting.
When you use the -platformpluginpath option you tell Qt where to find the platform plugins (like libqxcb.so).
-
@hskoglund Thank you for clarifying that.
Thanks to that i got on the right track. Assuming that libqxcb.so was missing because the option -qt-xcb was dropped was a mistake.
I found this thread https://github.com/bincrafters/community/issues/1229 that showed me that i might miss a dependency. As proposed i have added the -xcb option when calling configure. It showed a few failing tests.
I was not able to find a log for those tests but the config.log showed that "test config.qtbase_gui.libraries.xcb_util" was failing due to a missing xcb-utilh. While this was none of the tests i was looking for it made me check if all of the requirements mentioned at https://doc.qt.io/qt-5/linux-requirements.html are installed. None was missing, so i did some guesses.Since there none "dev" variants are on the requirement list i have installed:
- libxcb-render0-dev
- libxcb-util0-dev (due to similarity in name i assume that this fixed the missing xcb-util.h)
and since a pthread test was failing i installed
- libpthread-stubs0-dev
Now libqxcb.so is generated when building Qt. I conclude that the official requirements list for Qt 5 is missing at least one package.
My problem is solved. This thread may be closed.