Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/qt5/qt5webkit: fix QMake-generated artifacts location and content
@ 2026-06-05 11:12 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
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Louvel via buildroot @ 2026-06-05 11:12 UTC (permalink / raw)
  To: buildroot; +Cc: Nico Orlando, Roberto Zelbi, Paul Louvel

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

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>
---
 ...-conditional-on-CMAKE_INSTALL_PREFIX.patch | 32 +++++++++++++++++++
 package/qt5/qt5webkit/qt5webkit.mk            | 19 +++++++++++
 2 files changed, 51 insertions(+)
 create mode 100644 package/qt5/qt5webkit/0014-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch

diff --git a/package/qt5/qt5webkit/0014-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch b/package/qt5/qt5webkit/0014-remove-conditional-on-CMAKE_INSTALL_PREFIX.patch
new file mode 100644
index 0000000000..ccfbaa5b10
--- /dev/null
+++ b/package/qt5/qt5webkit/0014-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..a5f44b2260 100644
--- a/package/qt5/qt5webkit/qt5webkit.mk
+++ b/package/qt5/qt5webkit/qt5webkit.mk
@@ -51,10 +51,29 @@ QT5WEBKIT_CONF_OPTS += -DENABLE_SAMPLING_PROFILER=OFF
 endif
 
 QT5WEBKIT_CONF_OPTS += \
+	-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))
-- 
Paul Louvel, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-06 14:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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   ` [Buildroot] [PATCH v2 2/2] package/qt5/qt5webkit: fix QMake-generated artifacts location and content Angelo Compagnucci

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox