pkgconf now replacing pkg-config in RHEL 8

Latest response

I work in an organization that relies heavily on in-house developed software, and we've been based on RHEL for longer than I've been here. I write software mainly targeted to RHEL 6 and 7, and I often use Fedora for development and my own personal computers.

Recently I've run into a strange situation with setting up libraries after installation with pkg-config. Noteably that it doesn't include /usr/local/lib/pkgconfig in its default search path for .pc files, and that you can't override this behavior by setting PKG_CONFIG_PATH in the normal way. After much head scratching and wasted time, I discovered that as of F26, the standard pkg-config utility was replaced by another utility called pkgconf, with /usr/bin/pkg-config replaced with a symlink. This would be fine if pkgconf were compatible with the real pkg-config, a utility that much of the linux C developer world uses and depends on, but it's not.

Now, I've found that this mistake has been propagated to RHEL 8.

Now I'm left in a position where in-house written and 3rd-party libraries installed to the correct, canonical location for locally-compiled software (/usr/local/lib) cannot be found by this fake pkg-config utility, even when PKG_CONFIG_PATH is correctly set to /usr/local/lib/pkgconfig, due to what is either a defect or a designed incompatibility in this new utility.

[chris@delphinus-a pkgconfig]$ pwd
/usr/local/lib/pkgconfig
[chris@delphinus-a pkgconfig]$ ls
libexample.pc
[chris@delphinus-a pkgconfig]$ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
[chris@delphinus-a pkgconfig]$ echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
[chris@delphinus-a pkgconfig]$ pkg-config --cflags libexample
Package libexample was not found in the pkg-config search path.
Perhaps you should add the directory containing `libexample.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libexample', required by 'virtual:world', not found
[chris@delphinus-a pkgconfig]$ echo $PKG_CONFIG_PATH
/usr/local/lib/pkgconfig
[chris@delphinus-a pkgconfig]$ pkg-config --variable pc_path pkg-config
/usr/lib64/pkgconfig:/usr/share/pkgconfig

This seems like a pretty fundamental problem for RHEL 8 shops that operate with a lot of internally-developed software, and/or 3rd-party software that's compiled from source. I'm having no luck in finding anything online about what developers working in Fedora or RHEL 8 generally do about it however, except waste time in confusion as I have recently. Should I just have install scripts try to detect that the target platform is Fedora or RHEL 8 using pkgconf, and put .pc files in /usr/share/pkgconfig instead? (I hope it's clear that this is a terrible, kludgy solution.)

It seems like the switch to this "pkgconf" utility is the answer to a question that essentially no one was asking, and as an incompatible replacement to a core utility that the linux development community depends on, it is causing more problems than it's solving.

Responses