Qemu recipe adds host pkg-config paths to PKG_CONFIG_PATH using
hardcoded pkg-config tool's location (/usr/bin:/bin). This may cause
qemu build failures on systems that use external native toolchain (from
buildtools tarball): a host package is detected during do_configure via
host PKG_CONFIG_PATH, but then the toolchain can't find the package
because it uses headers from buildtools-tarball only.

For example if xkbcommon is present on host, but not in
buildtools-tarball:
| 
build/tmp/work/x86_64-linux/qemu-system-native/4.1.0-r0/qemu-4.1.0/qemu-keymap.c:16:10:
 fatal error: xkbcommon/xkbcommon.h: No such file or directory
|    16 | #include <xkbcommon/xkbcommon.h>
|       |          ^~~~~~~~~~~~~~~~~~~~~~~
| compilation terminated.
| make: *** 
[build/tmp/work/x86_64-linux/qemu-system-native/4.1.0-r0/qemu-4.1.0/rules.mak:69:
 qemu-keymap.o] Error 1

Using hardcoded pkg-config path seems like a hack. It was added to
handle a case when host sdl is provided by host. So limit usage of
host pkg-config only to the case when ASSUME_PROVIDED contains
libsdl2-native.

Signed-off-by: Taras Kondratiuk <takon...@cisco.com>
---
 meta/recipes-devtools/qemu/qemu.inc | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-devtools/qemu/qemu.inc 
b/meta/recipes-devtools/qemu/qemu.inc
index d41cc8f200b3..bfa69c402c8b 100644
--- a/meta/recipes-devtools/qemu/qemu.inc
+++ b/meta/recipes-devtools/qemu/qemu.inc
@@ -93,10 +93,12 @@ B = "${WORKDIR}/build"
 EXTRA_OECONF_append = " --python=${HOSTTOOLS_DIR}/python3"
 
 do_configure_prepend_class-native() {
-       # Append build host pkg-config paths for native target since the host 
may provide sdl
-       BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable pc_path 
pkg-config || echo "")
-       if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
-               export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
+       # Append build host pkg-config paths for native target if the host 
provides sdl
+       if ${@bb.utils.contains('ASSUME_PROVIDED', 'libsdl2-native', 'true', 
'false', d)}; then
+               BHOST_PKGCONFIG_PATH=$(PATH=/usr/bin:/bin pkg-config --variable 
pc_path pkg-config || echo "")
+               if [ ! -z "$BHOST_PKGCONFIG_PATH" ]; then
+                       export 
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:$BHOST_PKGCONFIG_PATH
+               fi
        fi
 }
 
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#140570): 
https://lists.openembedded.org/g/openembedded-core/message/140570
Mute This Topic: https://lists.openembedded.org/mt/75465548/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub  
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to