From 5ef861d7cec088eaf2bc36094028b156cdf84527 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Wed, 14 Jun 2023 18:58:11 -0700 Subject: [PATCH] qtwebengine: Pass OE specific pkg-config-native for host pkg-config chromium has a way to use right pkg-config for in-tree hosttools which are built and used during cross build of qtwebengine, since OE pkg-config environment is set for detecting .pc files from sysroot,it ends up reading wrong pkg-config files for host pieces and adds -L/usr/lib to linker cmdline for hosttools too, this goes by fine with gnu BFD linker since it ignores linker script files like /usr/lib/libc.so, but when we use LLD linker, it ends up in error, because it tries to process the content of libc.so which have target absolute paths for ldso etc. /usr/lib/ld-linux-aarch64.so.1 LLD tries to open these files and ofcouse can't find them because they are only found in target sysroot. The underlying problem is that we need to be explicit about pkg-config which is thusly implemented by this patch. This fixes build with clang+lld and link times for qtwebegine is reduced by 26% in my case. Change-Id: Id091200444eb97d4b44d984888a8aa16b75ff9d7 Reviewed-by: Mikko Gronoff (cherry picked from commit 5daa561cad1285f0303d228deaae17932c93b287) (cherry picked from commit ec5f347bb567c1e80911aa6c8b07252cc2bbeea9) --- recipes-qt/qt6/gn-utils.inc | 7 +++++++ recipes-qt/qt6/qtwebengine_git.bb | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/recipes-qt/qt6/gn-utils.inc b/recipes-qt/qt6/gn-utils.inc index cdfd9c4..6588a5f 100644 --- a/recipes-qt/qt6/gn-utils.inc +++ b/recipes-qt/qt6/gn-utils.inc @@ -46,6 +46,10 @@ def gn_target_arch_name(d): 'GN_TARGET_ARCH_NAME variable could not be found.') return name +def gn_host_pkg_config(d): + """Return absolute paths to pkg-config-native.""" + return d.getVar("STAGING_BINDIR_NATIVE") + "/" + "pkg-config-native" + def write_toolchain_file(d, file_path): """Creates a complete GN toolchain file in |file_path|.""" import string @@ -69,6 +73,7 @@ def write_toolchain_file(d, file_path): ' current_cpu = "${current_cpu}"\n' ' current_os = "linux"\n' ' is_clang = false\n' + ' host_pkg_config = "${host_pkg_config}"\n' ' }\n' '}\n' ) @@ -76,6 +81,7 @@ def write_toolchain_file(d, file_path): native_toolchain = { 'toolchain_name': 'yocto_native', 'current_cpu': gn_host_arch_name(d), + 'host_pkg_config': gn_host_pkg_config(d), 'cc': d.expand('${BUILD_CC}'), 'cxx': d.expand('${BUILD_CXX}'), 'ar': d.expand('${BUILD_AR}'), @@ -89,6 +95,7 @@ def write_toolchain_file(d, file_path): target_toolchain = { 'toolchain_name': 'yocto_target', 'current_cpu': gn_target_arch_name(d), + 'host_pkg_config': gn_host_pkg_config(d), 'cc': d.expand('${CC}'), 'cxx': d.expand('${CXX}'), 'ar': d.expand('${AR}'), diff --git a/recipes-qt/qt6/qtwebengine_git.bb b/recipes-qt/qt6/qtwebengine_git.bb index 7df8537..94c3d2e 100644 --- a/recipes-qt/qt6/qtwebengine_git.bb +++ b/recipes-qt/qt6/qtwebengine_git.bb @@ -2,6 +2,7 @@ require recipes-qt/qt6/qtwebengine.inc require recipes-qt/qt6/chromium-gn.inc DEPENDS += " \ + fontconfig-native \ nodejs-native \ gperf-native \ bison-native \ @@ -56,7 +57,7 @@ PACKAGECONFIG[libevent] = "-DFEATURE_webengine_system_libevent=ON,-DFEATURE_webe PACKAGECONFIG[libjpeg] = "-DFEATURE_webengine_system_libjpeg=ON,-DFEATURE_webengine_system_libjpeg=OFF,jpeg" PACKAGECONFIG[libpng] = "-DFEATURE_webengine_system_libpng=ON,-DFEATURE_webengine_system_libpng=OFF,libpng" PACKAGECONFIG[libvpx] = "-DFEATURE_webengine_system_libvpx=ON,-DFEATURE_webengine_system_libvpx=OFF,libvpx" -PACKAGECONFIG[libwebp] = "-DFEATURE_webengine_system_libwebp=ON,-DFEATURE_webengine_system_libwebp=OFF,libwebp" +PACKAGECONFIG[libwebp] = "-DFEATURE_webengine_system_libwebp=ON,-DFEATURE_webengine_system_libwebp=OFF,libwebp libwebp-native" PACKAGECONFIG[libxml] = "-DFEATURE_webengine_system_libxml=ON,-DFEATURE_webengine_system_libxml=OFF,libxml2 libxslt" PACKAGECONFIG[opus] = "-DFEATURE_webengine_system_opus=ON,-DFEATURE_webengine_system_opus=OFF,libopus" PACKAGECONFIG[libpci] = "-DFEATURE_webengine_system_libpci=ON,-DFEATURE_webengine_system_libpci=OFF,pciutils"