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<sysroot>/usr/lib to linker cmdline for hosttools too, this goes by
fine with gnu BFD linker since it ignores linker script files like
<sysroot>/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.

Pick-to: 6.5.11
Change-Id: Id091200444eb97d4b44d984888a8aa16b75ff9d7
Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io>
(cherry picked from commit 5daa561cad)
This commit is contained in:
Khem Raj 2023-06-14 18:58:11 -07:00 committed by Samuli Piippo
parent 171bb90b5c
commit ec5f347bb5
2 changed files with 9 additions and 1 deletions

View File

@ -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}'),

View File

@ -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"