Bug 15284 - qemu-system-native build fails depending on packages installed on build host
Summary: qemu-system-native build fails depending on packages installed on build host
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: devtools / tool chain (show other bugs)
Version: 4.2.3
Hardware: All Multiple
: Medium+ minor
Target Milestone: 5.0 M1
Assignee: Ross Burton
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-11-17 11:04 UTC by Christian Thießen
Modified: 2024-02-01 16:07 UTC (History)
4 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: Don't know


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Thießen 2023-11-17 11:04:51 UTC
On a Debian 12/bookworm build machine that happened to have libsndio-dev installed, a Yocto build of qemu-system-native fails with

| ../qemu-7.2.0/audio/sndioaudio.c:18:10: fatal error: sndio.h: No such file or directory                                                                                                                                                                      
|    18 | #include <sndio.h>                                                                                                                                                                                                                                   

It seems this happens due to poky/meta/recipes-devtools/qemu/qemu.inc setting BHOST_PKGCONFIG_PATH and thereby including the host pkg-config path. pkg-config thus finds the host sndio (as can be verified in log.do_configure), but
pkg-config --cflags sndio
returns an empty line because sndio.h is located in the standard path /usr/include. This path is then not searched during the build, causing the error.
The same problem would probably happen for other qemu dependencies that have headers directly in /usr/include, not in a subdirectory.

Possible solutions:
- If BHOST_PKGCONFIG_PATH is really only for finding sdl, we could implement a way to limit the search in the host path to only that package.
- If it is intended that pkg-config should also find other dependencies in the host path, pkg-config could be called with the --keep-system-cflags option so it emits a -I/usr/include (but that may lead to more headers being taken from there than we intended...)
- If we now always build libsdl2-native instead of using the host library, the whole mechanism might also be removed.
- If we keep everything as it is, the documentation could also be extended to list "negative system requirements", i.e. removing all libraries qemu might depend on.
Comment 1 Ross Burton 2023-11-23 16:25:56 UTC
qemu-system-native is special in that its one of the few packages allowed to look on the build host for libraries.  I'm guessing we don't want to enable sndio by default, so the easiest thing would be to explicitly add -Dsndio=disabled to EXTRA_OECMAKE.

Would you be able to test that and send a patch?
Comment 2 Ross Burton 2024-01-19 12:58:25 UTC
Patch on the list.
Comment 3 Ross Burton 2024-02-01 16:07:46 UTC
Merged in e746182638aeb9bdd1bbb7430de214d8d847a8b6.