Static build of Qt + Wayland
-
Hello, I'm relatively new to Qt, so forgive my ignorance.
I'm doing this as a learning experience.I have done the following steps to build Qt6.5 (dev) statically:
./init-repository --module-subset=qtbase,qtdeclarative,qtshadertools,qtwayland ./configure -prefix ../qt6dot5 -static -release -nomake tests -nomake examples cmake --build . --parallel cmake --install .
(I think I also tried it with Qt6.2, so I don't think the Qt version is the issue, but I can try again if needed.)
It builds successfully after installing Mesa's OpenGL and the needed xcb/X11 development libraries.
Now, if I import this self built Qt6.5 in QtCreator and run my applications, it works okay, on XWayland. I'd like my apps to run natively on Wayland (I'm on Linux, KDE Plasma 5.26.2, the Wayland compositor is KWin). This works fine with dynamic linking IIRC.
I figured I needed a
qt_import_plugins()
call in my CMakeLists.txt to INCLUDE aQt::QWaylandIntegrationPlugin
, since I need to manually add plugins when using a static build. But then I get this error withQT_DEBUG_PLUGINS=1
:qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QPA.QPlatformThemeFactoryInterface.5.1" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QStyleFactoryInterface" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.WaylandClient.QWaylandShellIntegrationFactoryInterface.5.3" since plugins are disabled in static builds qt.qpa.wayland: No shell integration named "xdg-shell" found qt.qpa.wayland: No shell integration named "wl-shell" found qt.qpa.wayland: No shell integration named "ivi-shell" found qt.qpa.wayland: No shell integration named "qt-shell" found qt.qpa.wayland: Loading shell integration failed. qt.qpa.wayland: Attempted to load the following shells QList("xdg-shell", "wl-shell", "ivi-shell", "qt-shell") qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.WaylandClient.QWaylandClientBufferIntegrationFactoryInterface.5.3" since plugins are disabled in static builds qt.qpa.wayland: Failed to load client buffer integration: "wayland-egl" qt.qpa.wayland: Available client buffer integrations: QList() qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QAccessibleFactoryInterface" since plugins are disabled in static builds qt.core.plugin.factoryloader: ignoring "org.qt-project.Qt.QAccessibleBridgeFactoryInterface" since plugins are disabled in static builds
I can't figure out how to proceed from there. My guess for the next step would be to use
QT_WAYLAND_SHELL_INTEGRATION
in some way, or maybe I'm missing something for QtWayland. -
@Herzenschein I've solved it by adding
Qt${QT_VERSION_MAJOR}::WaylandClientPrivate
totarget_link_libraries()
of the app.
Also add-system-freetype -fontconfig
to configure, to not see squares instead of letters. And-no-prefix
instead of-prefix ...
makes it easier, since you wont have to install.