Skip to contentSkip to conversation

fix: use pkgconf instead of pkg-config

PATCH In review Frede Braendstrup 5 participants 7 messages Aug 29, 2025 – Sep 2, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix: use pkgconf instead of pkg-config

As a preface, I know this is probably a bit of an aggressive move. But pkg-config doesn't build on newer GCC and Clang compilers due to a lot of hardening. The old K&R style C code is deprecated and cannot compile in the gcc default mode.

pkgconf is a modern and compatible (although not necessarily bug compatible) alternative that is maintained, and has more features that are not available in the old pkg-config. I've been using this patch for a while now, and it has worked flawlessly.

---
 meta/classes-recipe/pkgconfig.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/pkgconfig.bbclass +1 -1
index 1e1f3824dd..55847fb705 100644
@@ -4,5 +4,5 @@
 # SPDX-License-Identifier: MIT
 #
 
-DEPENDS:prepend = "pkgconfig-native "
+DEPENDS:prepend = "pkgconf-native "
 
Signature · 1 line
2.50.1
#2 lore raw

And the prefix should be "pkgconfig.bbclass: " instead of "fix: " as it's rather change in behavior/feature not fix of a bug. FWIW:
pkgconfig-native builds fine here even with gcc-15 on host and it surely builds fine on autobuilder as well, so the explanation in commit message should be improved a bit to describe how it's actually failing in your setup.

Quoted 25 lines · Antonin Godard via lists.yoctoproject.org

Hi,

To get reviewed this patch should be sent to the openembedded-core mailing list and should apply to the openembedded-core repository, not Poky.

Please see https://docs.yoctoproject.org/contributor-guide/identify-component.html.

Thanks,
Antonin

--
Antonin Godard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13737): https://lists.yoctoproject.org/g/poky/message/13737
Mute This Topic: https://lists.yoctoproject.org/mt/114950667/3617156
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#3 lore raw
In reply to Frede Braendstrup
Quoted 11 lines · Frederik Brændstrup via lists.yoctoproject.org

As a preface, I know this is probably a bit of an aggressive move. But pkg-config doesn't build on newer GCC and Clang compilers due to a lot of hardening. The old K&R style C code is deprecated and cannot compile in the gcc default mode.

pkgconf is a modern and compatible (although not necessarily bug compatible) alternative that is maintained, and has more features that are not available in the old pkg-config. I've been using this patch for a while now, and it has worked flawlessly.

This is bold and worth consideration, some other distros e.g. archlinux use it too however
we need to soak it a bit more for yocto because its not battle tested for cross-compiled systems.
Yoe distro defaulted to it in 2018 [1] for a while but some packages e.g. chromium/firefox
builds were not happy. Perhaps things have improved overtime.

[1] https://github.com/YoeDistro/yoe-distro/blob/master/sources/meta-yoe/conf/distro/yoe.inc#L126-L129

Quoted 28 lines
---
 meta/classes-recipe/pkgconfig.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/classes-recipe/pkgconfig.bbclass +1 -2
index 1e1f3824dd..55847fb705 100644
@@ -4,5 +4,5 @@
 # SPDX-License-Identifier: MIT
 #
 
-DEPENDS:prepend = "pkgconfig-native "
+DEPENDS:prepend = "pkgconf-native "
 
--

2.50.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13736): https://lists.yoctoproject.org/g/poky/message/13736
Mute This Topic: https://lists.yoctoproject.org/mt/114950667/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

#4 lore raw
In reply to Frede Braendstrup
Quoted 6 lines · Frederik Brændstrup via lists.yoctoproject.org

As a preface, I know this is probably a bit of an aggressive move. But pkg-config doesn't build on newer GCC and Clang compilers due to a lot of hardening. The old K&R style C code is deprecated and cannot compile in the gcc default mode.

Quoted 6 lines

pkgconf is a modern and compatible (although not necessarily bug compatible) alternative that is maintained, and has more features that are not available in the old pkg-config. I've been using this patch for a while now, and it has worked flawlessly.

First, I’m 100% on board with this. But the last time I did a test build with pkg-config vs pkgconf there were some differences in the output.

Have you done a world build with and without this change, and verified that the output is identical?

Also, this should go to [email protected] <mailto:[email protected]> so can you follow-up on there?

Thanks,
Ross

#5 lore raw
Quoted 14 lines · Ross Burton
Quoted 6 lines · Frederik Brændstrup via lists.yoctoproject.org

As a preface, I know this is probably a bit of an aggressive move. But pkg-config doesn't build on newer GCC and Clang compilers due to a lot of hardening. The old K&R style C code is deprecated and cannot compile in the gcc default mode.

Quoted 6 lines

pkgconf is a modern and compatible (although not necessarily bug compatible) alternative that is maintained, and has more features that are not available in the old pkg-config. I've been using this patch for a while now, and it has worked flawlessly.

Quoted 9 lines

First, I’m 100% on board with this. But the last time I did a test build with pkg-config vs pkgconf there were some differences in the output.

Have you done a world build with and without this change, and verified that the output is identical?

Also, this should go to [email protected] <mailto:[email protected]> so can you follow-up on there?

Thanks,
Ross

Hi Ross

I must admit, that I've only experimented with this in my own embedded projects, so there's not really much evidence that this "just works". The issue I ran into, which was fixed by this, was that pkg-config just didn't build on modern compilers as I wrote initially.

I'm willing to put in some time to making this work though, but I will probably need some guidance in respect to what level of similarity we need and how to verify it properly. Currently I just know that all of the recipes I've built produce a binary, but I haven't given much thought to binary equivalence.

I'll start by kicking off a world build, and seeing where that goes.

/Frede

#6 lore raw
In reply to Frede Braendstrup
Quoted 10 lines · Frederik Brændstrup via lists.yoctoproject.org

As a preface, I know this is probably a bit of an aggressive move. But pkg-config doesn't build on newer GCC and Clang compilers due to a lot of hardening. The old K&R style C code is deprecated and cannot compile in the gcc default mode.

pkgconf is a modern and compatible (although not necessarily bug compatible) alternative that is maintained, and has more features that are not available in the old pkg-config. I've been using this patch for a while now, and it has worked flawlessly.

Did a core-image-sato, and as I suspected:

| make[1]: Entering directory '/work/ross/build/tmp/work/cortexa57-poky-linux/libxcb/1.17.0/build/src'
| make[1]: Leaving directory '/work/ross/build/tmp/work/cortexa57-poky-linux/libxcb/1.17.0/build/src'
| make[1]: *** No rule to make target '//usr/share/xcb/', needed by 'xproto.c'.  Stop.

ERROR: Task (/home/rosbur01/Yocto/poky/meta/recipes-graphics/xorg-lib/libxcb_1.17.0.bb:do_compile) failed with exit code ‘1'

Most people don’t build with sysroots, and there’s a difference in behaviour between pkg-config and pkgconf.

I still believe we should move to pkgconf as it’s actually got a maintainer, but it’s not just a one-line change.

However, I’ve not seen pkg-config fail with modern compilers, because we build it with latest gcc/clang. What failures are you seeing?

Ross