Problem running application on Linux. Ubuntu 22.04 LTS + Wayland platform.
-
Which Qt version are you using?
-
Hi All,
I'm having some trouble packaging my application for distribution on Linux.
Specifically, getting it to run with the wayland platform plugin.Below is the Log of app startup, with QT_DEBUG_PLUGINS=1
james@Ubuntu22:~/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64$ ./MyApp qt.core.plugin.factoryloader: checking directory path "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms" ... qt.core.plugin.factoryloader: looking at "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so" qt.core.plugin.loader: Found metadata in lib /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland" ] }, "archlevel": 1, "className": "QWaylandIntegrationPlugin", "debug": false, "version": 394496 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland") qt.core.plugin.factoryloader: looking at "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/qwayland-generic.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/qwayland-egl.debug" qt.core.plugin.factoryloader: "The shared library was not found." not a plugin qt.core.plugin.factoryloader: looking at "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-egl.so" qt.core.plugin.loader: Found metadata in lib /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-egl" ] }, "archlevel": 1, "className": "QWaylandEglPlatformIntegrationPlugin", "debug": false, "version": 394496 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl") qt.core.plugin.factoryloader: checking directory path "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/platforms" ... qt.core.library: "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so" cannot load: Cannot load library /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so: (/lib/x86_64-linux-gnu/libQt6WaylandClient.so.6: undefined symbol: _ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb, version Qt_6_PRIVATE_API) qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so" : "Cannot load library /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so: (/lib/x86_64-linux-gnu/libQt6WaylandClient.so.6: undefined symbol: _ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb, version Qt_6_PRIVATE_API)" qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found. 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. Available platform plugins are: wayland, wayland-egl. Aborted (core dumped)
I can get the app to run by using the xcb platform plugin,
So I have been able to run the app.
However I run into some bugs when running xcb on a wayland based system
and I'd prefer to target wayland if possible.Any ideas why it's not able to resolve the symbols from the libQt6WaylandClient library?
I do have a copy of that file in usr/lib/x86_64-linux-gnuAny thoughts?
@Jammin44fm said in Problem running application on Linux. Ubuntu 22.04 LTS + Wayland platform.:
Any ideas why it's not able to resolve the symbols from the libQt6WaylandClient library?
I do have a copy of that file in usr/lib/x86_64-linux-gnuBecause it is not the exact same version and built with the exact same compiler as the Wayland platform plugin that attempts to load it. You need to make sure that you deploy the Wayland Qt module from the same Qt build you compiled against.
-
In this case I'm using Qt 6.5.3, however newer versions of the app are using 6.8.3.
Does this mean I will need to distribute a different version of the libQt6WaylandClient for each version of Qt that i'm using? -
In this case I'm using Qt 6.5.3, however newer versions of the app are using 6.8.3.
Does this mean I will need to distribute a different version of the libQt6WaylandClient for each version of Qt that i'm using?Hi @Jammin44fm,
Does this mean I will need to distribute a different version of the
libQt6WaylandClient
for each version of Qt that i'm using?Not necessarily, but yes, usually.
Like so many projects, Qt provides the following ABI guarantees:
Major releases may break backwards binary and source compatibility, although source compatibility may be maintained.
Minor releases are backwards binary and source compatible.
Patch releases are both backwards and forwards binary and source compatible.
So, in your case, an app built using Qt 6.8.3 is not compatible with Qt 6.5.3, because Qt 6.5.3 is only backward compatible with Qt's <= 6.5.x (and >= 6.0.0), not forward compatible with, for example, 6.8.
In this case I'm using Qt 6.5.3, however newer versions of the app are using 6.8.3.
In this case, if the app was built (to link dynamically) with Qt 6.8.3, then it must, at runtime, link to Qt6 v6.8.0+
In practice, its usually best to either:
- build the app against the distro's official Qt version (ie for *nixes); or
- package the necessart Qt libs with the app itself (hence tools like linuxdeploy-plugin-qt, macdeployqt, and windeployqt).
Cheers.
-
I think we're getting off track here.
I'm mainly concerned with getting my current Qt 6.5.3 application running properly on ubuntu 22.04 LTS.I can worry about potential other version problems in the future.
What is the status of the linuxdeploy-plugin-qt? it doesn't look like it's part of the official Qt package?
-
Your original post contains this:
qt.core.library: "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so" cannot load: Cannot load library /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so: (/lib/x86_64-linux-gnu/libQt6WaylandClient.so.6: undefined symbol: _ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb, version Qt_6_PRIVATE_API) qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so" : "Cannot load library /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-generic.so: (/lib/x86_64-linux-gnu/libQt6WaylandClient.so.6: undefined symbol: _ZN21QPlatformBackingStore15composeAndFlushEP7QWindowRK7QRegionRK6QPointP20QPlatformTextureListb, version Qt_6_PRIVATE_API)" qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
The plugin it is trying to load cannot find a library containing:
QPlatformBackingStore::composeAndFlush(QWindow*, QRegion const&, QPoint const&, QPlatformTextureList*, bool)
... and it fails to load. This could be because you are missing a library from Qt in your package, or because you have mixed versions (e.g. an app built again Qt 6.5.3 and libraries/plugins from another version and variations).
-
In this case I'm using Qt 6.5.3, however newer versions of the app are using 6.8.3.
Does this mean I will need to distribute a different version of the libQt6WaylandClient for each version of Qt that i'm using?@Jammin44fm said in Problem running application on Linux. Ubuntu 22.04 LTS + Wayland platform.:
Does this mean I will need to distribute a different version of the libQt6WaylandClient for each version of Qt that i'm using?
To make it simple - yes. The ABI promises Qt makes are for applications making use of published APIs. They do not extend to different modules of the framework itself - you should never mix say QtGui 6.8.1 with QtCore 6.8.0; same for QPA plugins (as they make use of private API).
Basically, when bundling Qt for distribution - you must copy ALL modules and plugins that the application uses, and not allow any to be used from the containing system. QtWaylandClient included in that - though it needs to be usually manually included as tools scanning dynamic library dependencies often can't see it.
What is the status of the linuxdeploy-plugin-qt? it doesn't look like it's part of the official Qt package?
It is not official. It works, I use it. As for status, I believe it is actively maintained, although as with pretty much all AppImage tooling it is done by one guy in a basement.
Deploying Wayland plugins with
linuxdeploy-qt
has to be done with care. It works for me by includingwaylandcompositor
in theEXTRA_QT_MODULES
environment variable. -
Hi all,
thanks for the help so far.
I've decided to go with just the wayland-egl platform,
as that is what is suggested by the Qt docs as being the ideal target platform.So this is Ubuntu 22.04 LTS, with the application built against Qt 6.5.3,
attempting to use the wayalnd-egl platform.I've modified my application so that it packages the correct files, afaik.
However i when i run my application i still run into problems.BUT if I specify the platform via adding the "-platform wayland-egl"
or by exporting the QT_QPA_PLATFORM=wayland-egl
My app starts as expected.
However neither of these represent an ideal or long term solution :(Below is the log of attempting to start my app with no args, or special QPA platform setting
james@Ubuntu22:~/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64$ ./MyApp qt.core.plugin.factoryloader: checking directory path "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms" ... qt.core.plugin.factoryloader: looking at "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-egl.so" qt.core.plugin.loader: Found metadata in lib /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-egl" ] }, "archlevel": 1, "className": "QWaylandEglPlatformIntegrationPlugin", "debug": false, "version": 394496 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl") qt.core.plugin.factoryloader: checking directory path "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/platforms" ... qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "" 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. Available platform plugins are: wayland-egl. Aborted (core dumped)
Looking at this log it looks like the qt.core.plugin.factoryloader is able to see the wayland-egl.so,
but for some reason the qt.qpa.plugin is unable to find or load the wayland-egl platform??Why isnt my application loading correctly using the wayland-egl platform as is?
What is the recommended way to tell package your application which platform to use?
I assume it is just putting the "libqwayland-egl.so" in the right location.
which for me is the Qt/platforms location.
I did look into maybe using the qt.conf file to try and specify the platform,
but it doesn't appear to have any options for this either :(The fact this works when i specify the platform to use, indicates that most things are in place,
I'm just stumped as to why it wont use the wayland-egl by default!! -
Hi all,
thanks for the help so far.
I've decided to go with just the wayland-egl platform,
as that is what is suggested by the Qt docs as being the ideal target platform.So this is Ubuntu 22.04 LTS, with the application built against Qt 6.5.3,
attempting to use the wayalnd-egl platform.I've modified my application so that it packages the correct files, afaik.
However i when i run my application i still run into problems.BUT if I specify the platform via adding the "-platform wayland-egl"
or by exporting the QT_QPA_PLATFORM=wayland-egl
My app starts as expected.
However neither of these represent an ideal or long term solution :(Below is the log of attempting to start my app with no args, or special QPA platform setting
james@Ubuntu22:~/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64$ ./MyApp qt.core.plugin.factoryloader: checking directory path "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms" ... qt.core.plugin.factoryloader: looking at "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-egl.so" qt.core.plugin.loader: Found metadata in lib /home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/Qt/platforms/libqwayland-egl.so, metadata= { "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3", "MetaData": { "Keys": [ "wayland-egl" ] }, "archlevel": 1, "className": "QWaylandEglPlatformIntegrationPlugin", "debug": false, "version": 394496 } qt.core.plugin.factoryloader: Got keys from plugin meta data QList("wayland-egl") qt.core.plugin.factoryloader: checking directory path "/home/ProjectS/Perforce/release.2.3/studio/platforms/linux/_builds/Debug/x86_64/platforms" ... qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "" 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. Available platform plugins are: wayland-egl. Aborted (core dumped)
Looking at this log it looks like the qt.core.plugin.factoryloader is able to see the wayland-egl.so,
but for some reason the qt.qpa.plugin is unable to find or load the wayland-egl platform??Why isnt my application loading correctly using the wayland-egl platform as is?
What is the recommended way to tell package your application which platform to use?
I assume it is just putting the "libqwayland-egl.so" in the right location.
which for me is the Qt/platforms location.
I did look into maybe using the qt.conf file to try and specify the platform,
but it doesn't appear to have any options for this either :(The fact this works when i specify the platform to use, indicates that most things are in place,
I'm just stumped as to why it wont use the wayland-egl by default!!@Jammin44fm said in Problem running application on Linux. Ubuntu 22.04 LTS + Wayland platform.:
I've decided to go with just the wayland-egl platform,
as that is what is suggested by the Qt docs as being the ideal target platform.Where did you read this? In case it was in this page, do note that it is about making a Wayland compositor with Qt - not a client application (and talks about the EGL hardware integration plugin, which is only tangentially related to the Wayland-EGL platform plugin).
Applications that just run on a Linux desktop against a generic compositor (i.e KDE/Sway/GNOME/etc.) and don't have a particular reason to care about which protocol exactly is used to manage the shared graphics buffers - should use the generic Wayland platform plugin. EGL used to have some support issues around certain compositors and particularly nVidia drivers, so it makes sense for it to be something you explicitly opt into if you insist on using it.
The fact this works when i specify the platform to use, indicates that most things are in place,
I'm just stumped as to why it wont use the wayland-egl by default!!That's not how it works with platform plugins. Qt won't just load the first one that happens to be available/working - many of the plugins shipped with Qt are for specialized purposes; it would quite confusing indeed if an application would just proceed to load the
minimal
plugin by default if the i.e. thexcb
plugin is missing or broken!Essentially, if no platform plugins are explicitly requested via command line or environment variable, there is a compiled in default that says what to use. On generic Linux this is
xcb
, and if Wayland is detected to be running then alsowayland
(which is provided bylibqwayland-generic.so
). As to whywayland-egl
isn't tried by default as well, see the above. -
@Jammin44fm said in Problem running application on Linux. Ubuntu 22.04 LTS + Wayland platform.:
I've decided to go with just the wayland-egl platform,
as that is what is suggested by the Qt docs as being the ideal target platform.Where did you read this? In case it was in this page, do note that it is about making a Wayland compositor with Qt - not a client application (and talks about the EGL hardware integration plugin, which is only tangentially related to the Wayland-EGL platform plugin).
Applications that just run on a Linux desktop against a generic compositor (i.e KDE/Sway/GNOME/etc.) and don't have a particular reason to care about which protocol exactly is used to manage the shared graphics buffers - should use the generic Wayland platform plugin. EGL used to have some support issues around certain compositors and particularly nVidia drivers, so it makes sense for it to be something you explicitly opt into if you insist on using it.
The fact this works when i specify the platform to use, indicates that most things are in place,
I'm just stumped as to why it wont use the wayland-egl by default!!That's not how it works with platform plugins. Qt won't just load the first one that happens to be available/working - many of the plugins shipped with Qt are for specialized purposes; it would quite confusing indeed if an application would just proceed to load the
minimal
plugin by default if the i.e. thexcb
plugin is missing or broken!Essentially, if no platform plugins are explicitly requested via command line or environment variable, there is a compiled in default that says what to use. On generic Linux this is
xcb
, and if Wayland is detected to be running then alsowayland
(which is provided bylibqwayland-generic.so
). As to whywayland-egl
isn't tried by default as well, see the above.Thank you for the clarification,
I will pursue using the default wayland platform plugin, which I assume means using the libwayland-generic.so
library in my platform/ location.Your clarification about how Qt chooses a platform backend is also helpful and informative,
and makes sense given what i am seeing.
Hopefully i can manage to get the generic wayland platform working.Thanks again,
James -
Alright! it's all working thank you very much for your help.
I've got my app being distributed with both the wayland and xcb files.
I'm copying both libQt6WaylandEglClientHwIntegration.so.6 and libQt6WaylandClient.so.6
into my core Qt\libs\ dir.
as well as the wayland-decoration-client, wayland-graphics-integration-client and wayland-shell-integration dirs into my Qt folder too.I thin it was the missing integration folders that was causing me to have problems earlier on.
Thanks for you help everyone, and hopefully this can assist someone in the future.- James
-