X11 vs Wayland
-
I have created two Qt5 apps. They exploit the libraries libQt5Core, libQt5DBus, libQt5Gui, libQt5Widgets, libQt5Xml and libQt5XcbQpa libraries (and hence the libqxcb platforms library) next to the libicudata, libicui18n, libicuuc libraries. I have deployed these apps to Linux, MacOS and Windows. The Linux targets rely on the approach of the Linux/X11 deployment approach of https://doc.qt.io/qt-5/linux-deployment.html
Both apps run out-of-the-box on various X11-based Linux distributions. However, only one of them runs out-of-the-box on the latest fedora, which is wayland-based (i.e. not X11-based). The only difference between the two apps that I can think may be relevant is that the one that does not work out-of-the-box on fedora relies on the library and plugin-infrastructure of the Qt-framework (as used in for example the Plug & Paint example at https://doc.qt.io/qt-5/qtwidgets-tools-plugandpaint-app-example.html) and it also uses a 3rd party library (a modified version of libQt5OfficeOpenXml). I get the following error when trying to run this app on fedora:
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway. qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Available platform plugins are: xcb. ./run.sh: line 2: 3698 Aborted (core dumped) LD_LIBRARY_PATH=$(dirname $0)/lib:$LD_LIBRARY_PATH ./$(dirname $0)/app
So, to bypass this problem, I recompiled this app on fedora and created a deployable file set using the same set of libraries (i.e. also libQt5XcbQpa and libqxcb)! This works like a charm on other wayland-based systems but not on X11-based systems. When trying to run the fedora deployable on ubuntu 18.04 LTS (which is X11-based), I get the following error:
qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "" This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem. Aborted (core dumped)
I was wondering whether others are experiencing similar issues or if somebody has an idea of how to resolve this in such a way that I only need to create one deployable that works for both X11 and Wayland-based Linux systems
-
One additional discovery. If I replace the main executable file of my app on the fedora setup by the one compiled on fedora, but do not make any changes to the libraries taken from the X11 setup, then it works perfectly on fedora. Interestingly, the main executable that is created on Ubuntu 18.04 LTS and Fedora 31 are of exactly the same size. So, I would guess that something goes wrong with the symbols when using Qt-framework for creating libraries?
By the way, I am using Qt5.12.5 and QtCreator 4.11.0 on both setups.
-
I hve discovered what the problem was. I was apparently using the incorrect version of the libqxcb platform library. I have now created a package that works on all the different Linux distributions for which I had issues :)
I was using the libqxcb version that comes in the QtCreator directories, while the correct one is in the gcc directories. I discovered this by noticing that these two have a different file size.
-
@ModelTech Yes, you should only use libs from Qt installation you're using, not from QtCreator.
-
Thanks, that is what I learned indeed :)
I have always been creating deployable packages by copying the previous version and updating my own stuff, but never checked that the depending libraries could have changed. That was however the case now, so it caused the issue. Lesson learned :)