Re: [OE-core] [PATCH 5/8] classes/pkgconfig: rationalise variable usage

Mathieu Dubois-Briand
2026-01-28T13:30:43Z

On Fri Jan 23, 2026 at 7:04 PM CET, Ross Burton via lists.openembedded.org wrote:
> Our PKG_CONFIG_* variables were a bit of a mess.
>
> First, PKG_CONFIG_DIR is not used by either pkg-config or pkgconf. It's
> set to (approximately) ${libdir}/pkgconfig but we also want to search
> ${datadir}/pkgconfig so it isn't actually useful as an intermediate
> variable.
>
> Remove PKG_CONFIG_DIR and replace with the neatest expression for the
> value we want: ${STAGING_LIBDIR}/pkgconfig.
>
> Second, PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR shouldn't be set to the
> same paths. The semantics of these variables is that PKG_CONFIG_PATH is
> searched first, followed by either PKG_CONFIG_LIBDIR or the default paths
> compiled into the pkg-config binary.
>
> Currently we set PKG_CONFIG_PATH to (approx.) ${libdir}:${datadir} and
> PKG_CONFIG_LIBDIR to ${libdir}, so we search libdir twice.
>
> Also the default paths embedded in the binary will be incorrect as they
> point to pkgconfig-native's sysroot, so we absolutely need to set
> PKG_CONFIG_LIBDIR.
>
> Instead, set PKG_CONFIG_LIBDIR to ${libdir}:${datadir} so that the
> default search path is correct. We can then leave PKG_CONFIG_PATH empty,
> if a recipe has specific needs it can set that but normally it is not
> needed anymore.
>
> Then bubble these changes out to the few places where the variables are
> used directly:
>
> - Kernel/kconfig interaction where 'pkg-config' needs to read the
> native files, not target.
>
> - The class classes (native, etc) which redefine the values. However,
> as the values are defined in terms of sysroot variables, we can
> typically remove assignments from those classes as they are redundant.
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---

Hi Ross,

This patch is almost fine on the autobuilder, with one little exception:
it breaks runtime_test.TestImage.test_testimage_virgl_gtk_sdl on some
hosts. Or to go further, when qemu-system-native is compiled with "gtk+"
PACKAGECONFIG, the it will have a dependency on host glib version and
might complain it is too old:

ERROR: qemu-system-native-10.2.0-r0 do_configure: Execution of '/srv/pokybuild/yocto-worker/oe-selftest-debian/build/build-st-2977320/tmp/work/x86_64-linux/qemu-system-native/10.2.0/temp/run.do_configure.845525' failed with exit code 1
...
| ../sources/qemu-10.2.0/meson.build:1951:8: ERROR: Dependency lookup for gtk+-3.0 with method 'pkgconfig' failed: Could not generate cflags for gtk+-3.0:
| Package 'pango' requires 'glib-2.0 >= 2.82' but version of glib-2.0 is 2.66.8

https://autobuilder.yoctoproject.org/valkyrie/#/builders/35/builds/3105

This can be reproduced by either running
runtime_test.TestImage.test_testimage_virgl_gtk_sdl selftest, or just
building qemu-system-native with:
PACKAGECONFIG:append:pn-qemu-system-native = " gtk+"

Can you have a look at what is going wrong here?

Thanks,
Mathieu

--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering