From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: buildroot@buildroot.org
Cc: Paul Louvel <paul.louvel@bootlin.com>,
Giulio Benetti <giulio.benetti@benettiengineering.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
"Yann E . MORIN" <yann.morin.1998@free.fr>,
Thomas Ballasi <thomas.ballasi@savoirfairelinux.com>,
Nico Orlando <nico.orlando@dave.eu>,
Roberto Zelbi <roberto.zelbi@dave.eu>,
Angelo Compagnucci <angelo.compagnucci@gmail.com>
Subject: [Buildroot] [PATCH v2 2/2] package/qt5/qt5webkit: fix QMake-generated artifacts location and content
Date: Fri, 6 Nov 2026 15:34:09 +0100 [thread overview]
Message-ID: <20261106143409.2581133-2-angelo.compagnucci@gmail.com> (raw)
In-Reply-To: <20261106143409.2581133-1-angelo.compagnucci@gmail.com>
From: Paul Louvel <paul.louvel@bootlin.com>
Building qt-webkit-kiosk fails because of several issues in the
configuration and installation process of the qt5webkit package.
A previous patch from Thomas Ballasi attempted to fix the issue [1].
Packages depending on QtWebKit and using QMake as their build system
initially fail with the following error (qt-webkit-kiosk):
Project MESSAGE: Settings:
Project MESSAGE: - QT : core gui network webkit widgets webkitwidgets printsupport multimedia testlib
Project MESSAGE: - PREFIX : /usr
Project MESSAGE: - TARGET : qt-webkit-kiosk
Project MESSAGE: - VERSION: 1.99.6
Project ERROR: Unknown module(s) in QT: webkit webkitwidgets
When resolving dependencies, the host qmake searches for module pri
files in:
$(HOST_DIR)/mkspecs/modules
However, the qt5webkit package incorrectly installs its pri files into:
$(STAGING_DIR)/usr/mkspecs/modules
As a result, qmake cannot locate the required module definitions.
Additionally, the generated pri files contain hardcoded include and
library paths instead of using the appropriate qmake variables:
$$QT_MODULE_LIB_BASE for library paths
$$QT_MODULE_INCLUDE_BASE for include paths
Using hardcoded paths leads to a build failure even if the module
definitions are correctly located:
cpu-vendor-os-g++: ERROR: unsafe header/library path used in cross-compilation: '-I/usr/include'
The header files are also installed in
$(STAGING_DIR)/usr/include instead of
$(STAGING_DIR)/usr/include/qt5, which is the expected location for Qt
headers.
These problems can be fixed by using QMake system paths retrieved by CMake at
configure time with the qmake -query command. qt5webkit provides a
KDE_INSTALL_USE_QT_SYS_PATHS option that must be set to ON for the build system
to correctly use QMake configuration properties and install headers and module
definitions in the proper locations.
The patch from Thomas Ballasi used the
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT configuration option to set
CMAKE_INSTALL_PREFIX to the correct Qt installation prefix.
Projects may check this variable to set CMAKE_INSTALL_PREFIX to a value other than
the default "/usr/local" on UNIX platforms.
However, CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is not intended to be set
by users. It is implicitly set to ON when CMAKE_INSTALL_PREFIX is unset, and to
OFF otherwise, regardless of whether it was explicitly set by the user. In
Buildroot, CMAKE_INSTALL_PREFIX is set to "/usr" by the default CMake
configuration command, rendering this fix ineffective because as a result,
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT is set to OFF.
Adding -DKDE_INSTALL_USE_QT_SYS_PATHS=ON fixes the header installation location,
but the pri files are still installed in the wrong location. This is caused by
the conditional in OptionsQt.cmake that sets KDE_INSTALL_USE_QT_SYS_PATHS to OFF
when CMAKE_INSTALL_PREFIX differs from the Qt installation prefix directory,
which is the case because Buildroot sets it to "/usr" by default.
Removing this check fixes the pri file content issue, but the build then fails
with another error:
qt5webkit: installs files in $(STAGING_DIR)/$(HOST_DIR)
Because the DESTDIR parameter used by the default CMake _INSTALL_STAGING_CMDS is
set to $(STAGING_DIR), it gets prepended to the absolute installation path of
the module definitions:
$(HOST_DIR)/mkspecs/modules
The resulting installation path is wrong:
$(STAGING_DIR)/$(HOST_DIR)/mkspecs/modules
Defining custom QT5WEBKIT_INSTALL_{STAGING,TARGET}_CMDS commands that do not use
the DESTDIR variable fixes this issue. Instead, an alternative installation
prefix is specified with:
--prefix=$(STAGING_DIR)/usr for staging --prefix=$(TARGET_DIR)/usr for target
With KDE_INSTALL_USE_QT_SYS_PATHS=ON, the QML directory is also taken from
qmake, as an absolute path in the staging directory: with the OpenGL support
of qt5base, which enables the WebKit2 QML API, the QtWebKit QML module would
be installed in $(STAGING_DIR)/usr/qml also by the target installation, and
never in $(TARGET_DIR). Set KDE_INSTALL_QMLDIR to "qml", relative to the
installation prefix, so that it follows --prefix.
Tested with a QEMU x86_64 target. qt-webkit-kiosk builds and runs successfully.
Please take into account that Qt WebKit is an old, deprecated project intended
to be replaced by Qt WebEngine [2] [3].
In addition, there has been no release since March 10, 2020, apart from
security-fix releases [4].
[1] https://patchwork.ozlabs.org/project/buildroot/patch/20220929181350.1026033-1-thomas.ballasi@savoirfairelinux.com/
Note: Thomas refers to 'DATADIR' in his patch, but I believe he means
'DESTDIR' instead.
[2] https://forum.qt.io/topic/65982/now-that-qwebkit-has-been-deprecated-what-can-i-do
[3] https://lists.buildroot.org/pipermail/buildroot/2015-July/496272.html
[4] https://github.com/qtwebkit/qtwebkit/releases/tag/qtwebkit-5.212.0-alpha4
Fixes: https://lists.buildroot.org/pipermail/buildroot/2022-February/323066.html
Signed-off-by: Paul Louvel (DAVE.eu) <paul.louvel@bootlin.com>
Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v1 -> v2:
- rename the qtwebkit patch to 0015, 0014 is now taken by
0014-gcc16.patch;
- set KDE_INSTALL_QMLDIR to "qml": with KDE_INSTALL_USE_QT_SYS_PATHS=ON
the QML directory is the absolute staging path from qmake, so the
QtWebKit QML module was only installed in staging, never in the
target.
Tested: Bootlin x86_64 glibc stable toolchain, qt5base with OpenGL ES2
(mesa3d softpipe, EGL) and eglfs, qt5declarative, qt5webkit (WebKit2 ON) and
qt-webkit-kiosk: everything builds, Qt reports "Qt OpenGL libraries:
Qt5::Gui_GLESv2" and "Qt EGL libraries: Qt5::Gui_EGL", libWebCore links
libGLESv2/libEGL, the qt_lib_webkit*.pri files are in
$(HOST_DIR)/mkspecs/modules, the headers in $(STAGING_DIR)/usr/include/qt5,
and the QtWebKit QML module in both $(STAGING_DIR)/usr/qml and
$(TARGET_DIR)/usr/qml. Not run-time tested.
...-conditional-on-CMAKE_INSTALL_PREFIX.patch | 32 +++++++++++++++++++
package/qt5/qt5webkit/qt5webkit.mk | 20 ++++++++++++
2 files changed, 52 insertions(+)
create mode 100644 package/qt5/qt5webkit/0015-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch
diff --git a/package/qt5/qt5webkit/0015-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch b/package/qt5/qt5webkit/0015-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch
new file mode 100644
index 0000000000..ccfbaa5b10
--- /dev/null
+++ b/package/qt5/qt5webkit/0015-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch
@@ -0,0 +1,32 @@
+From 38e96676cda9e555b4c55102a57e29c2073c30c2 Mon Sep 17 00:00:00 2001
+From: Paul Louvel <paul.louvel@bootlin.com>
+Date: Fri, 22 May 2026 15:47:43 +0200
+Subject: [PATCH] remove conditional on CMAKE_INSTALL_PREFIX.
+
+Remove a conditional on CMAKE_INSTALL_PREFIX, since Buildroot sets it to "/usr"
+by default. Prevent setting KDE_INSTALL_USE_QT_SYS_PATHS to OFF, which would
+cause the project to ignore QMake installation properties and install the module
+mkspecs in the wrong location with wrong values.
+
+Upstream: N/A QtWebkit is not maintained anymore, and this patch is only
+relevant for Buildroot.
+Signed-off-by: Paul Louvel <paul.louvel@bootlin.com>
+---
+ Source/cmake/OptionsQt.cmake | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/Source/cmake/OptionsQt.cmake b/Source/cmake/OptionsQt.cmake
+index 71f9afa01..fd52e8eab 100644
+--- a/Source/cmake/OptionsQt.cmake
++++ b/Source/cmake/OptionsQt.cmake
+@@ -1008,10 +1008,6 @@ endif ()
+
+ include(KDEInstallDirs)
+
+-if (NOT qt_install_prefix_dir STREQUAL "${CMAKE_INSTALL_PREFIX}")
+- set(KDE_INSTALL_USE_QT_SYS_PATHS OFF)
+-endif ()
+-
+ # We split all installed files into 2 components: Code and Data. This is different from
+ # traditional approach with Runtime and Devel, but we need it to fix concurrent installation of
+ # debug and release builds in qmake-based build
diff --git a/package/qt5/qt5webkit/qt5webkit.mk b/package/qt5/qt5webkit/qt5webkit.mk
index 6912359674..961dbd8daf 100644
--- a/package/qt5/qt5webkit/qt5webkit.mk
+++ b/package/qt5/qt5webkit/qt5webkit.mk
@@ -51,10 +51,30 @@ QT5WEBKIT_CONF_OPTS += -DENABLE_SAMPLING_PROFILER=OFF
endif
QT5WEBKIT_CONF_OPTS += \
+ -DKDE_INSTALL_QMLDIR=qml \
+ -DKDE_INSTALL_USE_QT_SYS_PATHS=ON \
-DENABLE_TOOLS=OFF \
-DPORT=Qt \
-DPYTHON_EXECUTABLE=$(HOST_DIR)/bin/python3 \
-DSHARED_CORE=ON \
-DUSE_LIBHYPHEN=OFF
+# Remove the DESTDIR from the install command install so that the .pri files in
+# the correct location: $(HOST_DIR)/mkspecs/modules instead of
+# $(STAGING_DIR)$(HOST_DIR)/usr/mkspecs/modules.
+define QT5WEBKIT_INSTALL_STAGING_CMDS
+ $(TARGET_MAKE_ENV) $(QT5WEBKIT_BUILD_ENV) \
+ $(BR2_CMAKE) --install $(QT5WEBKIT_BUILDDIR) \
+ --prefix $(STAGING_DIR)/usr
+endef
+
+# Remove the DESTDIR from the install command install so that the .pri files in
+# the correct location: $(HOST_DIR)/mkspecs/modules instead of
+# $(TARGET_DIR)$(HOST_DIR)/usr/mkspecs/modules.
+define QT5WEBKIT_INSTALL_TARGET_CMDS
+ $(TARGET_MAKE_ENV) $(QT5WEBKIT_BUILD_ENV) \
+ $(BR2_CMAKE) --install $(QT5WEBKIT_BUILDDIR) \
+ --prefix $(TARGET_DIR)/usr
+endef
+
$(eval $(cmake-package))
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2026-11-06 14:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-05 11:12 [Buildroot] [PATCH] package/qt5/qt5webkit: fix QMake-generated artifacts location and content Paul Louvel via buildroot
2026-11-06 14:34 ` [Buildroot] [PATCH v2 1/2] package/qt5/qt5base: export the OpenGL and EGL library dirs to CMake Angelo Compagnucci
2026-11-06 14:34 ` Angelo Compagnucci [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261106143409.2581133-2-angelo.compagnucci@gmail.com \
--to=angelo.compagnucci@gmail.com \
--cc=buildroot@buildroot.org \
--cc=giulio.benetti@benettiengineering.com \
--cc=nico.orlando@dave.eu \
--cc=paul.louvel@bootlin.com \
--cc=roberto.zelbi@dave.eu \
--cc=thomas.ballasi@savoirfairelinux.com \
--cc=thomas.petazzoni@bootlin.com \
--cc=yann.morin.1998@free.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox