public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Rationalise the pkg-config variables
@ 2026-01-23 18:04 Ross Burton
  2026-01-23 18:04 ` [PATCH 1/8] pkgconfig: inherit the pkgconfig class Ross Burton
                   ` (8 more replies)
  0 siblings, 9 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

Hi,

This series cleans up and rationalises the pkg-config variables, with the
goal of following the majority of major distros and later switching from
pkg-config (last release: 2017) to pkgconf (last release: June 2025).

However, this series doesn't do that.

The first three patches are adding missing inherits, or fixing a bug in
numpy that we were lucky enough not to hit.

The next two are the key patches, specifically "classes/pkgconfig: rationalise
variable usage" is the meat of the series that actually changes the
variables and contains the rationale.

The next two are improvements for pkgconf that we might as well apply now.

Finally, a controversial patch to drop support for a working menuconfig on
kernels older than 5.15. If there is a need to support 5.10 then the small
fix to the kernel Makefiles should be an easy backport.  This patch is not
needed though, and can be dropped.

Cheers,
Ross

Ross Burton (8):
  pkgconfig: inherit the pkgconfig class
  perf: inherit the pkgconfig class
  python3-numpy: backport a Meson patch to fix pkg-config lookups
  classes/pkgconfig: move variable exports to the class
  classes/pkgconfig: rationalise variable usage
  pkgconf: small cleanups
  pkgconf: add pkg-config-native to the nativesdk package
  kernel: remove pkg-config variables for old (<5.19) kernels

 meta/classes-recipe/cml1.bbclass              |  7 ++--
 meta/classes-recipe/cross-canadian.bbclass    |  3 +-
 meta/classes-recipe/cross.bbclass             |  4 +--
 meta/classes-recipe/kernel.bbclass            | 13 -------
 meta/classes-recipe/native.bbclass            |  1 -
 meta/classes-recipe/nativesdk.bbclass         |  3 --
 meta/classes-recipe/pkgconfig.bbclass         |  6 ++++
 meta/conf/bitbake.conf                        | 14 ++++----
 .../pkgconf/pkgconf/pkg-config-native.in      |  3 +-
 .../recipes-devtools/pkgconf/pkgconf_2.5.1.bb | 14 ++++++--
 .../pkgconfig/pkgconfig_git.bb                |  4 +--
 .../python3-numpy/0001-python-sysroot.patch   | 34 +++++++++++++++++++
 .../python/python3-numpy_2.3.5.bb             |  1 +
 meta/recipes-kernel/linux/linux-yocto.inc     |  8 ++---
 meta/recipes-kernel/perf/perf.bb              |  3 +-
 15 files changed, 72 insertions(+), 46 deletions(-)
 create mode 100644 meta/recipes-devtools/python/python3-numpy/0001-python-sysroot.patch

-- 
2.43.0



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/8] pkgconfig: inherit the pkgconfig class
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:04 ` [PATCH 2/8] perf: " Ross Burton
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

Building target pkgconfig needs pkgconfig-native because pkgconfig uses
pkgconfig to find libglib.  Inherit the pkgconfig class so that the
pkgconfig recipe does not need to know the details of how pkgconfig is
integrated.

Native builds use an internal copy of glib to avoid the circular
dependency, and the self-dependency on pkgconfig-native is automatically
pruned.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/pkgconfig/pkgconfig_git.bb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
index 19b9b6bc9d..d4350be212 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
@@ -19,7 +19,7 @@ SRC_URI = "git://gitlab.freedesktop.org/pkg-config/pkg-config.git;branch=master;
 		   file://0001-Backport-g-s-size-g-u-intptr-atomics-in-builtin-glib.patch \
            "
 
-inherit autotools
+inherit autotools pkgconfig
 
 # Because of a faulty test, the current auto mode always evaluates to no,
 # so just continue that behaviour.
@@ -29,7 +29,7 @@ EXTRA_OECONF += "--disable-indirect-deps"
 PACKAGECONFIG ??= "glib"
 PACKAGECONFIG:class-native = ""
 
-PACKAGECONFIG[glib] = "--without-internal-glib,--with-internal-glib,glib-2.0 pkgconfig-native"
+PACKAGECONFIG[glib] = "--without-internal-glib,--with-internal-glib,glib-2.0"
 
 BBCLASSEXTEND = "native nativesdk"
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/8] perf: inherit the pkgconfig class
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
  2026-01-23 18:04 ` [PATCH 1/8] pkgconfig: inherit the pkgconfig class Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:04 ` [PATCH 3/8] python3-numpy: backport a Meson patch to fix pkg-config lookups Ross Burton
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

Perf uses pkg-config, so should inherit the class.

Also remove the sedding of PKG_CONFIG, we pass it in as an argument to
make via EXTRA_OEMAKE so the sed is redundant.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-kernel/perf/perf.bb | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/meta/recipes-kernel/perf/perf.bb b/meta/recipes-kernel/perf/perf.bb
index b69ba2ac12..7a58088462 100644
--- a/meta/recipes-kernel/perf/perf.bb
+++ b/meta/recipes-kernel/perf/perf.bb
@@ -55,7 +55,7 @@ do_configure[depends] += "virtual/kernel:do_shared_workdir"
 
 PROVIDES = "virtual/perf"
 
-inherit linux-kernel-base kernel-arch manpages
+inherit linux-kernel-base kernel-arch manpages pkgconfig
 
 # needed for building the tools/perf Python bindings
 inherit_defer ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python3targetconfig', '', d)}
@@ -349,7 +349,6 @@ do_configure:prepend () {
         sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/perf/Makefile.perf
         sed -i 's,AR = $(CROSS_COMPILE)ar,#AR,' ${S}/tools/perf/Makefile.perf
         sed -i 's,LD = $(CROSS_COMPILE)ld,#LD,' ${S}/tools/perf/Makefile.perf
-        sed -i 's,PKG_CONFIG = $(CROSS_COMPILE)pkg-config,#PKG_CONFIG,' ${S}/tools/perf/Makefile.perf
     fi
     if [ -e "${S}/tools/lib/api/Makefile" ]; then
         sed -i 's,CC = $(CROSS_COMPILE)gcc,#CC,' ${S}/tools/lib/api/Makefile
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/8] python3-numpy: backport a Meson patch to fix pkg-config lookups
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
  2026-01-23 18:04 ` [PATCH 1/8] pkgconfig: inherit the pkgconfig class Ross Burton
  2026-01-23 18:04 ` [PATCH 2/8] perf: " Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:04 ` [PATCH 4/8] classes/pkgconfig: move variable exports to the class Ross Burton
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

When Meson uses pkg-config to introspect the Python install it resets
PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR to the location that the running
python3 says is the library directory. However, when it writes to
PKG_CONFIG_LIBDIR it uses the _target_ library directory without
prefixing this with the sysroot, which breaks the build if _LIBDIR is
the primary search path.

This has been fixed in Meson since 1.10.0[1] but numpy has a vendored
fork of Meson that is currently at 1.9.2, so backport the specific fix
to solve this problem.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 .../python3-numpy/0001-python-sysroot.patch   | 34 +++++++++++++++++++
 .../python/python3-numpy_2.3.5.bb             |  1 +
 2 files changed, 35 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-numpy/0001-python-sysroot.patch

diff --git a/meta/recipes-devtools/python/python3-numpy/0001-python-sysroot.patch b/meta/recipes-devtools/python/python3-numpy/0001-python-sysroot.patch
new file mode 100644
index 0000000000..b22c123493
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-numpy/0001-python-sysroot.patch
@@ -0,0 +1,34 @@
+From c40218577305f5953ef63d943c26a27c5a931770 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Wed, 21 Jan 2026 14:12:36 +0000
+Subject: [PATCH] Add sysroot to pkgconfig libdir
+
+When Meson uses pkg-config to introspect the Python install it resets PKG_CONFIG_PATH
+and PKG_CONFIG_LIBDIR. However, when it writes to PKG_CONFIG_LIBDIR it uses the
+_target_ library directory without prefixing this with the sysroot, which breaks 
+the build if _LIBDIR is the primary search path.
+
+This has been fixed in Meson since 1.10.0[1] but numpy has a vendored fork of Meson
+that is currently at 1.9.2, so backport the specific fix to solve this problem.
+
+[1] meson 59c3dd1fd ("python: add a python.build_config option (PEP 739)")
+
+Upstream-Status: Backport
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ vendored-meson/meson/mesonbuild/dependencies/python.py | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/vendored-meson/meson/mesonbuild/dependencies/python.py b/vendored-meson/meson/mesonbuild/dependencies/python.py
+index 7f9bd20..fdcf714 100644
+--- a/vendored-meson/meson/mesonbuild/dependencies/python.py
++++ b/vendored-meson/meson/mesonbuild/dependencies/python.py
+@@ -412,6 +412,8 @@ def python_factory(env: 'Environment', for_machine: 'MachineChoice',
+     if DependencyMethods.PKGCONFIG in methods:
+         if from_installation:
+             pkg_libdir = installation.info['variables'].get('LIBPC')
++            sysroot = env.properties[for_machine].get_sys_root() or ''
++            pkg_libdir = sysroot + pkg_libdir
+             pkg_embed = '-embed' if embed and mesonlib.version_compare(installation.info['version'], '>=3.8') else ''
+             pkg_name = f'python-{pkg_version}{pkg_embed}'
+ 
diff --git a/meta/recipes-devtools/python/python3-numpy_2.3.5.bb b/meta/recipes-devtools/python/python3-numpy_2.3.5.bb
index 55b8091ff8..78972c98d3 100644
--- a/meta/recipes-devtools/python/python3-numpy_2.3.5.bb
+++ b/meta/recipes-devtools/python/python3-numpy_2.3.5.bb
@@ -11,6 +11,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/${SRCNAME}-${PV}.tar.gz \
            file://0001-Don-t-search-usr-and-so-on-for-libraries-by-default-.patch \
            file://fix_reproducibility.patch \
            file://run-ptest \
+           file://0001-python-sysroot.patch \
            "
 SRC_URI[sha256sum] = "784db1dcdab56bf0517743e746dfb0f885fc68d948aba86eeec2cba234bdf1c0"
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/8] classes/pkgconfig: move variable exports to the class
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
                   ` (2 preceding siblings ...)
  2026-01-23 18:04 ` [PATCH 3/8] python3-numpy: backport a Meson patch to fix pkg-config lookups Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:04 ` [PATCH 5/8] classes/pkgconfig: rationalise variable usage Ross Burton
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

All recipes that use pkg-config should be inheriting the class so this
is a no-op change for those, and for recipes that do not use pkg-config
will no longer need to rebuild if these variables are changed.

Any recipes that use pkg-config but do not inherit the class will fail
to build, and this is intentional: those recipes should inherit the class.

This commit is simply the move of the exports, the values do not change.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/pkgconfig.bbclass |  7 +++++++
 meta/conf/bitbake.conf                | 14 +++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/meta/classes-recipe/pkgconfig.bbclass b/meta/classes-recipe/pkgconfig.bbclass
index 1e1f3824dd..ea91338d34 100644
--- a/meta/classes-recipe/pkgconfig.bbclass
+++ b/meta/classes-recipe/pkgconfig.bbclass
@@ -6,3 +6,10 @@
 
 DEPENDS:prepend = "pkgconfig-native "
 
+export PKG_CONFIG_DIR
+export PKG_CONFIG_PATH
+export PKG_CONFIG_LIBDIR
+export PKG_CONFIG_SYSROOT_DIR
+export PKG_CONFIG_DISABLE_UNINSTALLED
+export PKG_CONFIG_SYSTEM_LIBRARY_PATH
+export PKG_CONFIG_SYSTEM_INCLUDE_PATH
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 88f4d0df69..8779f65157 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -768,13 +768,13 @@ BUILDCFG_NEEDEDVARS[type] = "list"
 
 # Other
 
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
-export PKG_CONFIG_PATH = "${PKG_CONFIG_DIR}:${STAGING_DATADIR}/pkgconfig"
-export PKG_CONFIG_LIBDIR = "${PKG_CONFIG_DIR}"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
-export PKG_CONFIG_DISABLE_UNINSTALLED = "yes"
-export PKG_CONFIG_SYSTEM_LIBRARY_PATH = "${base_libdir}:${libdir}"
-export PKG_CONFIG_SYSTEM_INCLUDE_PATH = "${includedir}"
+PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
+PKG_CONFIG_PATH = "${PKG_CONFIG_DIR}:${STAGING_DATADIR}/pkgconfig"
+PKG_CONFIG_LIBDIR = "${PKG_CONFIG_DIR}"
+PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
+PKG_CONFIG_DISABLE_UNINSTALLED = "yes"
+PKG_CONFIG_SYSTEM_LIBRARY_PATH = "${base_libdir}:${libdir}"
+PKG_CONFIG_SYSTEM_INCLUDE_PATH = "${includedir}"
 
 # Don't allow git to chdir up past WORKDIR or TMPDIR so that it doesn't detect the OE
 # repository when building a recipe.
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/8] classes/pkgconfig: rationalise variable usage
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
                   ` (3 preceding siblings ...)
  2026-01-23 18:04 ` [PATCH 4/8] classes/pkgconfig: move variable exports to the class Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-28 13:30   ` [OE-core] " Mathieu Dubois-Briand
  2026-01-23 18:04 ` [PATCH 6/8] pkgconf: small cleanups Ross Burton
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

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>
---
 meta/classes-recipe/cml1.bbclass           | 7 +++----
 meta/classes-recipe/cross-canadian.bbclass | 3 +--
 meta/classes-recipe/cross.bbclass          | 4 ++--
 meta/classes-recipe/kernel.bbclass         | 8 ++------
 meta/classes-recipe/native.bbclass         | 1 -
 meta/classes-recipe/nativesdk.bbclass      | 3 ---
 meta/classes-recipe/pkgconfig.bbclass      | 1 -
 meta/conf/bitbake.conf                     | 6 +++---
 meta/recipes-kernel/linux/linux-yocto.inc  | 7 +++----
 9 files changed, 14 insertions(+), 26 deletions(-)

diff --git a/meta/classes-recipe/cml1.bbclass b/meta/classes-recipe/cml1.bbclass
index 3c2b4da4af..ac65eec4bf 100644
--- a/meta/classes-recipe/cml1.bbclass
+++ b/meta/classes-recipe/cml1.bbclass
@@ -51,12 +51,11 @@ python do_menuconfig() {
         mtime = 0
 
     # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-    d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig")
-    d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig")
-    d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}")
+    d.setVar("PKG_CONFIG_PATH", "")
+    d.setVar("PKG_CONFIG_LIBDIR", "${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig")
     d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1")
     # ensure that environment variables are overwritten with this tasks 'd' values
-    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
+    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
 
     oe_terminal("sh -c 'make %s; if [ $? -ne 0 ]; then echo \"Command failed.\"; printf \"Press any key to continue... \"; read r; fi'" % d.getVar('KCONFIG_CONFIG_COMMAND'),
                 d.getVar('PN') + ' Configuration', d)
diff --git a/meta/classes-recipe/cross-canadian.bbclass b/meta/classes-recipe/cross-canadian.bbclass
index 059d9aa95f..6d3d2f7623 100644
--- a/meta/classes-recipe/cross-canadian.bbclass
+++ b/meta/classes-recipe/cross-canadian.bbclass
@@ -161,8 +161,7 @@ libexecdir = "${exec_prefix}/libexec/${TARGET_ARCH}${TARGET_VENDOR}-${TARGET_OS}
 
 FILES:${PN} = "${prefix}"
 
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${exec_prefix}/lib/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
+PKG_CONFIG_LIBDIR = "${STAGING_DIR_HOST}${exec_prefix}/lib/pkgconfig:${STAGING_DIR_HOST}${exec_prefix}/share/pkgconfig"
 
 do_populate_sysroot[stamp-extra-info] = ""
 do_packagedata[stamp-extra-info] = ""
diff --git a/meta/classes-recipe/cross.bbclass b/meta/classes-recipe/cross.bbclass
index 574ce6988d..82a49dc8f5 100644
--- a/meta/classes-recipe/cross.bbclass
+++ b/meta/classes-recipe/cross.bbclass
@@ -33,8 +33,8 @@ PACKAGE_ARCH = "${BUILD_ARCH}"
 
 MULTIMACH_TARGET_SYS = "${BUILD_ARCH}${BUILD_VENDOR}-${BUILD_OS}"
 
-export PKG_CONFIG_DIR = "${exec_prefix}/lib/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = ""
+PKG_CONFIG_LIBDIR = "${exec_prefix}/lib/pkgconfig:${exec_prefix}/share/pkgconfig"
+PKG_CONFIG_SYSROOT_DIR = ""
 
 TARGET_CPPFLAGS = ""
 TARGET_CFLAGS = ""
diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index f989b31c47..b43b4ff4fb 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -365,9 +365,7 @@ kernel_do_compile() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 
 	# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-	export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig"
-	export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig"
-	export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR"
+	export PKG_CONFIG_LIBDIR="${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig"
 	export PKG_CONFIG_SYSROOT_DIR=""
 
 	if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
@@ -421,9 +419,7 @@ do_compile_kernelmodules() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 
 	# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-	export PKG_CONFIG_DIR="${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig"
-	export PKG_CONFIG_PATH="$PKG_CONFIG_DIR:${STAGING_DATADIR_NATIVE}/pkgconfig"
-	export PKG_CONFIG_LIBDIR="$PKG_CONFIG_DIR"
+	export PKG_CONFIG_LIBDIR="${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig"
 	export PKG_CONFIG_SYSROOT_DIR=""
 
 	if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
diff --git a/meta/classes-recipe/native.bbclass b/meta/classes-recipe/native.bbclass
index b3411d20ca..e114669940 100644
--- a/meta/classes-recipe/native.bbclass
+++ b/meta/classes-recipe/native.bbclass
@@ -98,7 +98,6 @@ do_populate_sysroot[sstate-outputdirs] = "${COMPONENTS_DIR}/${PACKAGE_ARCH}/${PN
 # Since we actually install these into situ there is no staging prefix
 STAGING_DIR_HOST = ""
 STAGING_DIR_TARGET = ""
-PKG_CONFIG_DIR = "${libdir}/pkgconfig"
 
 EXTRA_NATIVE_PKGCONFIG_PATH ?= ""
 PKG_CONFIG_PATH .= "${EXTRA_NATIVE_PKGCONFIG_PATH}"
diff --git a/meta/classes-recipe/nativesdk.bbclass b/meta/classes-recipe/nativesdk.bbclass
index c2e53c8450..117cc2329f 100644
--- a/meta/classes-recipe/nativesdk.bbclass
+++ b/meta/classes-recipe/nativesdk.bbclass
@@ -74,9 +74,6 @@ exec_prefix = "${SDKPATHNATIVE}${prefix_nativesdk}"
 baselib = "lib"
 sbindir = "${bindir}"
 
-export PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
-export PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
-
 python nativesdk_virtclass_handler () {
     pn = e.data.getVar("PN")
     if not (pn.endswith("-nativesdk") or pn.startswith("nativesdk-")):
diff --git a/meta/classes-recipe/pkgconfig.bbclass b/meta/classes-recipe/pkgconfig.bbclass
index ea91338d34..50e74d0120 100644
--- a/meta/classes-recipe/pkgconfig.bbclass
+++ b/meta/classes-recipe/pkgconfig.bbclass
@@ -6,7 +6,6 @@
 
 DEPENDS:prepend = "pkgconfig-native "
 
-export PKG_CONFIG_DIR
 export PKG_CONFIG_PATH
 export PKG_CONFIG_LIBDIR
 export PKG_CONFIG_SYSROOT_DIR
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 8779f65157..a38f055598 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -768,11 +768,11 @@ BUILDCFG_NEEDEDVARS[type] = "list"
 
 # Other
 
-PKG_CONFIG_DIR = "${STAGING_DIR_HOST}${libdir}/pkgconfig"
-PKG_CONFIG_PATH = "${PKG_CONFIG_DIR}:${STAGING_DATADIR}/pkgconfig"
-PKG_CONFIG_LIBDIR = "${PKG_CONFIG_DIR}"
+PKG_CONFIG_PATH = ""
+PKG_CONFIG_LIBDIR = "${STAGING_LIBDIR}/pkgconfig:${STAGING_DATADIR}/pkgconfig"
 PKG_CONFIG_SYSROOT_DIR = "${STAGING_DIR_HOST}"
 PKG_CONFIG_DISABLE_UNINSTALLED = "yes"
+# With pkg-config these have the sysroot prefixed
 PKG_CONFIG_SYSTEM_LIBRARY_PATH = "${base_libdir}:${libdir}"
 PKG_CONFIG_SYSTEM_INCLUDE_PATH = "${includedir}"
 
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index 4d0a726bb6..d57c1aae25 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -89,9 +89,8 @@ EXTRA_OEMAKE += '${@bb.utils.contains("KERNEL_DEBUG", "True", "", "PAHOLE=false"
 
 do_devshell:prepend() {
     # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-    d.setVar("PKG_CONFIG_DIR", "${STAGING_DIR_NATIVE}${libdir_native}/pkgconfig")
-    d.setVar("PKG_CONFIG_PATH", "${PKG_CONFIG_DIR}:${STAGING_DATADIR_NATIVE}/pkgconfig")
-    d.setVar("PKG_CONFIG_LIBDIR", "${PKG_CONFIG_DIR}")
+    d.setVar("PKG_CONFIG_PATH", "")
+    d.setVar("PKG_CONFIG_LIBDIR", "${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig")
     d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1")
-    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_DIR PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
+    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
 }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/8] pkgconf: small cleanups
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
                   ` (4 preceding siblings ...)
  2026-01-23 18:04 ` [PATCH 5/8] classes/pkgconfig: rationalise variable usage Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:04 ` [PATCH 7/8] pkgconf: add pkg-config-native to the nativesdk package Ross Burton
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

There's no need to --with-pkg-confg-dir as the default is the same and
correct.

Don't append BBCLASSEXTEND, there's no need.

Sync pkg-config-native with the pkg-config recipe so that it sets
the variables in the same way.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in | 3 ++-
 meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb             | 5 ++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in b/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in
index 0d736fe4d4..8addefbb80 100644
--- a/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in
+++ b/meta/recipes-devtools/pkgconf/pkgconf/pkg-config-native.in
@@ -1,6 +1,7 @@
 #! /bin/sh
 
-PKG_CONFIG_PATH="@PATH_NATIVE@$EXTRA_NATIVE_PKGCONFIG_PATH"
+export PKG_CONFIG_PATH="@PATH_NATIVE@$EXTRA_NATIVE_PKGCONFIG_PATH"
+export PKG_CONFIG_LIBDIR="@LIBDIR_NATIVE@"
 unset PKG_CONFIG_SYSROOT_DIR
 
 pkg-config "$@"
diff --git a/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb b/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb
index 12ca075b5d..e3500431b3 100644
--- a/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb
+++ b/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb
@@ -24,8 +24,6 @@ SRC_URI[sha256sum] = "cd05c9589b9f86ecf044c10a2269822bc9eb001eced2582cfffd658b0a
 
 inherit autotools
 
-EXTRA_OECONF += "--with-pkg-config-dir='${libdir}/pkgconfig:${datadir}/pkgconfig'"
-
 do_install:append () {
     # Install a wrapper which deals, as much as possible with pkgconf vs
     # pkg-config compatibility issues.
@@ -36,6 +34,7 @@ do_install:append:class-native () {
     # Install a pkg-config-native wrapper that will use the native sysroot instead
     # of the MACHINE sysroot, for using pkg-config when building native tools.
     sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
+        -e "s|@LIBDIR_NATIVE@|${PKG_CONFIG_LIBDIR}|" \
         < ${UNPACKDIR}/pkg-config-native.in > ${B}/pkg-config-native
     install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config-native
     sed -e "s|@PATH_NATIVE@|${PKG_CONFIG_PATH}|" \
@@ -53,7 +52,7 @@ RPROVIDES:${PN} += "pkgconfig(pkg-config)"
 FILES:${PN}-dev:remove = "${datadir}/aclocal"
 FILES:${PN} += "${datadir}/aclocal"
 
-BBCLASSEXTEND += "native nativesdk"
+BBCLASSEXTEND = "native nativesdk"
 
 pkgconf_sstate_fixup_esdk () {
    if [ "${BB_CURRENTTASK}" = "populate_sysroot_setscene" -a "${WITHIN_EXT_SDK}" = "1" ] ; then
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/8] pkgconf: add pkg-config-native to the nativesdk package
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
                   ` (5 preceding siblings ...)
  2026-01-23 18:04 ` [PATCH 6/8] pkgconf: small cleanups Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:04 ` [PATCH 8/8] kernel: remove pkg-config variables for old (<5.15) kernels Ross Burton
  2026-01-23 18:07 ` [OE-core] [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

This was added to the pkg-config recipe but not pkgconf.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb b/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb
index e3500431b3..e335c843bd 100644
--- a/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb
+++ b/meta/recipes-devtools/pkgconf/pkgconf_2.5.1.bb
@@ -43,6 +43,15 @@ do_install:append:class-native () {
     install -m755 ${B}/pkg-config-esdk ${D}${bindir}/pkg-config-esdk
 }
 
+do_install:append:class-nativesdk () {
+    # Install a pkg-config-native wrapper that will use the native sysroot instead
+    # of the MACHINE sysroot, for using pkg-config when building native tools.
+    sed -e "s|@PATH_NATIVE@|\$OECORE_NATIVE_SYSROOT|" \
+        -e "s|@LIBDIR_NATIVE@|\$OECORE_NATIVE_SYSROOT/usr/lib/pkgconfig|" \
+        < ${UNPACKDIR}/pkg-config-native.in > ${B}/pkg-config-native
+    install -m755 ${B}/pkg-config-native ${D}${bindir}/pkg-config-native
+}
+
 # When using the RPM generated automatic package dependencies, some packages
 # will end up requiring 'pkgconfig(pkg-config)'.  Allow this behavior by
 # specifying an appropriate provide.
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 8/8] kernel: remove pkg-config variables for old (<5.15) kernels
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
                   ` (6 preceding siblings ...)
  2026-01-23 18:04 ` [PATCH 7/8] pkgconf: add pkg-config-native to the nativesdk package Ross Burton
@ 2026-01-23 18:04 ` Ross Burton
  2026-01-23 18:07 ` [OE-core] [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:04 UTC (permalink / raw)
  To: openembedded-core

The kernel has supported setting an alternative binary for pkg-config
with a variable since 5.19 (in 2022[1]) and we set that to
pkg-config-native, so there is no longer any need to also manually set
the PKG_CONFIG_* variables.

The relevant commit was backported and is present in 5.15.91 onwards,
but is not yet in 5.10.x.

[1] linux d5ea4fece450 ("kbuild: Allow kernel installation packaging to override pkg-config")

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 meta/classes-recipe/kernel.bbclass        | 9 ---------
 meta/recipes-kernel/linux/linux-yocto.inc | 7 ++-----
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index b43b4ff4fb..1ebf027281 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -251,7 +251,6 @@ KERNEL_EXTRA_ARGS ?= ""
 EXTRA_OEMAKE += ' CC="${KERNEL_CC}" LD="${KERNEL_LD}" OBJCOPY="${KERNEL_OBJCOPY}" STRIP="${KERNEL_STRIP}"'
 EXTRA_OEMAKE += ' HOSTCC="${BUILD_CC}" HOSTCFLAGS="${BUILD_CFLAGS}" HOSTLDFLAGS="${BUILD_LDFLAGS}" HOSTCPP="${BUILD_CPP}"'
 EXTRA_OEMAKE += ' HOSTCXX="${BUILD_CXX}" HOSTCXXFLAGS="${BUILD_CXXFLAGS}"'
-# Only for newer kernels (5.19+), native pkg-config variables are set for older kernels when building kernel and modules
 EXTRA_OEMAKE += ' HOSTPKG_CONFIG="pkg-config-native"'
 
 KERNEL_ALT_IMAGETYPE ??= ""
@@ -364,10 +363,6 @@ KERNEL_DEBUG_TIMESTAMPS ??= "0"
 kernel_do_compile() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 
-	# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-	export PKG_CONFIG_LIBDIR="${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig"
-	export PKG_CONFIG_SYSROOT_DIR=""
-
 	if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
 		# kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
 		# be set....
@@ -418,10 +413,6 @@ addtask transform_kernel after do_compile before do_install
 do_compile_kernelmodules() {
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 
-	# setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-	export PKG_CONFIG_LIBDIR="${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig"
-	export PKG_CONFIG_SYSROOT_DIR=""
-
 	if [ "${KERNEL_DEBUG_TIMESTAMPS}" != "1" ]; then
 		# kernel sources do not use do_unpack, so SOURCE_DATE_EPOCH may not
 		# be set....
diff --git a/meta/recipes-kernel/linux/linux-yocto.inc b/meta/recipes-kernel/linux/linux-yocto.inc
index d57c1aae25..4e230d405a 100644
--- a/meta/recipes-kernel/linux/linux-yocto.inc
+++ b/meta/recipes-kernel/linux/linux-yocto.inc
@@ -88,9 +88,6 @@ do_kernel_configme[depends] += '${@bb.utils.contains("KERNEL_DEBUG", "True", "pa
 EXTRA_OEMAKE += '${@bb.utils.contains("KERNEL_DEBUG", "True", "", "PAHOLE=false", d)}'
 
 do_devshell:prepend() {
-    # setup native pkg-config variables (kconfig scripts call pkg-config directly, cannot generically be overriden to pkg-config-native)
-    d.setVar("PKG_CONFIG_PATH", "")
-    d.setVar("PKG_CONFIG_LIBDIR", "${STAGING_LIBDIR_NATIVE}/pkgconfig:${STAGING_DATADIR_NATIVE}/pkgconfig")
-    d.setVarFlag("PKG_CONFIG_SYSROOT_DIR", "unexport", "1")
-    d.appendVar("OE_TERMINAL_EXPORTS", " PKG_CONFIG_PATH PKG_CONFIG_LIBDIR PKG_CONFIG_SYSROOT_DIR")
+    d.setVar("HOSTPKG_CONFIG", "pkg-config-native")
+    d.appendVar("OE_TERMINAL_EXPORTS", " HOSTPKG_CONFIG")
 }
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [OE-core] [PATCH 0/8] Rationalise the pkg-config variables
  2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
                   ` (7 preceding siblings ...)
  2026-01-23 18:04 ` [PATCH 8/8] kernel: remove pkg-config variables for old (<5.15) kernels Ross Burton
@ 2026-01-23 18:07 ` Ross Burton
  8 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-01-23 18:07 UTC (permalink / raw)
  To: openembedded-core@lists.openembedded.org

Hit send and immediately remembered I forgot something:

I did a build of “world core-image-sato:do_populate_sdk” for master and with this series, and compared the deploy/ipk/ directories. The only changes were in meta-environment and the python build configuration, where PKG_CONFIG_PATH changes to PKG_CONFIG_LIBDIR.

Ross


> On 23 Jan 2026, at 18:04, Ross Burton via lists.openembedded.org <ross.burton=arm.com@lists.openembedded.org> wrote:
> 
> Hi,
> 
> This series cleans up and rationalises the pkg-config variables, with the
> goal of following the majority of major distros and later switching from
> pkg-config (last release: 2017) to pkgconf (last release: June 2025).
> 
> However, this series doesn't do that.
> 
> The first three patches are adding missing inherits, or fixing a bug in
> numpy that we were lucky enough not to hit.
> 
> The next two are the key patches, specifically "classes/pkgconfig: rationalise
> variable usage" is the meat of the series that actually changes the
> variables and contains the rationale.
> 
> The next two are improvements for pkgconf that we might as well apply now.
> 
> Finally, a controversial patch to drop support for a working menuconfig on
> kernels older than 5.15. If there is a need to support 5.10 then the small
> fix to the kernel Makefiles should be an easy backport.  This patch is not
> needed though, and can be dropped.
> 
> Cheers,
> Ross
> 
> Ross Burton (8):
>  pkgconfig: inherit the pkgconfig class
>  perf: inherit the pkgconfig class
>  python3-numpy: backport a Meson patch to fix pkg-config lookups
>  classes/pkgconfig: move variable exports to the class
>  classes/pkgconfig: rationalise variable usage
>  pkgconf: small cleanups
>  pkgconf: add pkg-config-native to the nativesdk package
>  kernel: remove pkg-config variables for old (<5.19) kernels
> 
> meta/classes-recipe/cml1.bbclass              |  7 ++--
> meta/classes-recipe/cross-canadian.bbclass    |  3 +-
> meta/classes-recipe/cross.bbclass             |  4 +--
> meta/classes-recipe/kernel.bbclass            | 13 -------
> meta/classes-recipe/native.bbclass            |  1 -
> meta/classes-recipe/nativesdk.bbclass         |  3 --
> meta/classes-recipe/pkgconfig.bbclass         |  6 ++++
> meta/conf/bitbake.conf                        | 14 ++++----
> .../pkgconf/pkgconf/pkg-config-native.in      |  3 +-
> .../recipes-devtools/pkgconf/pkgconf_2.5.1.bb | 14 ++++++--
> .../pkgconfig/pkgconfig_git.bb                |  4 +--
> .../python3-numpy/0001-python-sysroot.patch   | 34 +++++++++++++++++++
> .../python/python3-numpy_2.3.5.bb             |  1 +
> meta/recipes-kernel/linux/linux-yocto.inc     |  8 ++---
> meta/recipes-kernel/perf/perf.bb              |  3 +-
> 15 files changed, 72 insertions(+), 46 deletions(-)
> create mode 100644 meta/recipes-devtools/python/python3-numpy/0001-python-sysroot.patch
> 
> -- 
> 2.43.0
> 
> 
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#229903): https://lists.openembedded.org/g/openembedded-core/message/229903
> Mute This Topic: https://lists.openembedded.org/mt/117422748/6875888
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ross.burton@arm.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [OE-core] [PATCH 5/8] classes/pkgconfig: rationalise variable usage
  2026-01-23 18:04 ` [PATCH 5/8] classes/pkgconfig: rationalise variable usage Ross Burton
@ 2026-01-28 13:30   ` Mathieu Dubois-Briand
  2026-01-29  6:17     ` Mathieu Dubois-Briand
  0 siblings, 1 reply; 13+ messages in thread
From: Mathieu Dubois-Briand @ 2026-01-28 13:30 UTC (permalink / raw)
  To: ross.burton, openembedded-core

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
https://bootlin.com



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [OE-core] [PATCH 5/8] classes/pkgconfig: rationalise variable usage
  2026-01-28 13:30   ` [OE-core] " Mathieu Dubois-Briand
@ 2026-01-29  6:17     ` Mathieu Dubois-Briand
  2026-02-06 10:29       ` Ross Burton
  0 siblings, 1 reply; 13+ messages in thread
From: Mathieu Dubois-Briand @ 2026-01-29  6:17 UTC (permalink / raw)
  To: ross.burton, openembedded-core

On Wed Jan 28, 2026 at 2:30 PM CET, Mathieu Dubois-Briand wrote:
> 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

Hi Ross,

I note this is also breaking meta-intel builds:

ERROR: libvpl-2.14.0-r0 do_configure: Execution of '/srv/pokybuild/yocto-worker/meta-intel/build/build/tmp/work/corei7-64-poky-linux/libvpl/2.14.0/temp/run.do_configure.2633134' failed with exit code 1
...
| -- Checking for module 'libva>=1.2'
| --   No package 'libva' found
| -- Checking for module 'libva-drm>=1.2'
| --   No package 'libva-drm' found
| CMake Error at examples/api2x/hello-vpp/CMakeLists.txt:78 (message):
|   libva not found: set LIBVA_SUPPORT=OFF to build hello-vpp without libva
|   support

https://autobuilder.yoctoproject.org/valkyrie/#/builders/41/builds/2937

Thanks,
Mathieu

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [OE-core] [PATCH 5/8] classes/pkgconfig: rationalise variable usage
  2026-01-29  6:17     ` Mathieu Dubois-Briand
@ 2026-02-06 10:29       ` Ross Burton
  0 siblings, 0 replies; 13+ messages in thread
From: Ross Burton @ 2026-02-06 10:29 UTC (permalink / raw)
  To: Mathieu Dubois-Briand; +Cc: openembedded-core@lists.openembedded.org

On 29 Jan 2026, at 06:17, Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> wrote:
> 
> I note this is also breaking meta-intel builds:

This one was easy, some recipes in meta-intel are not inheriting pkgconfig. Patch sent.

Ross

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2026-02-06 10:31 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-23 18:04 [PATCH 0/8] Rationalise the pkg-config variables Ross Burton
2026-01-23 18:04 ` [PATCH 1/8] pkgconfig: inherit the pkgconfig class Ross Burton
2026-01-23 18:04 ` [PATCH 2/8] perf: " Ross Burton
2026-01-23 18:04 ` [PATCH 3/8] python3-numpy: backport a Meson patch to fix pkg-config lookups Ross Burton
2026-01-23 18:04 ` [PATCH 4/8] classes/pkgconfig: move variable exports to the class Ross Burton
2026-01-23 18:04 ` [PATCH 5/8] classes/pkgconfig: rationalise variable usage Ross Burton
2026-01-28 13:30   ` [OE-core] " Mathieu Dubois-Briand
2026-01-29  6:17     ` Mathieu Dubois-Briand
2026-02-06 10:29       ` Ross Burton
2026-01-23 18:04 ` [PATCH 6/8] pkgconf: small cleanups Ross Burton
2026-01-23 18:04 ` [PATCH 7/8] pkgconf: add pkg-config-native to the nativesdk package Ross Burton
2026-01-23 18:04 ` [PATCH 8/8] kernel: remove pkg-config variables for old (<5.15) kernels Ross Burton
2026-01-23 18:07 ` [OE-core] [PATCH 0/8] Rationalise the pkg-config variables Ross Burton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox