/usr/local/lib64 is ignored by pkgconfig

Creating a bug report/issue

Required Information

  • DietPi version

root@DietPi:~/src/libdrm-2.4.116/b4# cat /boot/dietpi/.version
G_DIETPI_VERSION_CORE=8
G_DIETPI_VERSION_SUB=22
G_DIETPI_VERSION_RC=3
G_GITBRANCH='master'
G_GITOWNER='MichaIng
  • Distro version: bookworm

  • Kernel version: Linux DietPi 6.1.0-12-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.52-1 (2023-09-07) x86_64 GNU/Linux

  • Architecture: amd64

  • SBC model: Native PC (x86_64)

  • Power supply used: Factory included

  • SD card used: internal SSD

Additional Information (if applicable)

  • Software title: pkg-config
  • Was the software title installed freshly or updated/migrated?
    It was installed using apt-get.
  • Can this issue be replicated on a fresh installation of DietPi?
    Yes

Steps to reproduce

  1. Build a library from source and install it. For example, libdrm.
    It’s installed by default to /usr/local/lib64, as expected on x86_64.

  2. Run pkgconf --libs libdrm and see that it’s unable to locate libdrm.pc:

Package libdrm was not found in the pkg-config search path.
Perhaps you should add the directory containing `libdrm.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libdrm', required by 'virtual:world', not found

Expected behaviour

pkg-config should be able to locate the library’s .pc file inside /usr/local/lib64/pkgconfig

Actual behaviour

pkg-config is unable to locate the library’s .pc file inside /usr/local/lib64/pkgconfig

Extra details

If I move the /usr/local/lib64/pkgconfig directory to /usr/local/lib/pkgconfig, then pkg-config works as expected and is able to locate the .pc files.

Of course, I can simply add this to /etc/profile:

export PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig

…and pkg-config will work as expected with user-built+installed libs, but shouldn’t it be done by default on the system??

@MichaIng can you have a look pls.

I’m pretty sure that lib64 is not part of any default path. On Debian /lib64 and /usr/lib64 contain the single libc6 library as symlink to /lib/x86_64-linux-gnu, nothing else.

Here an old topic about Ubuntu, but I am pretty sure nothing has changed in the meantime (that lib64 became even more obsolete than ever) and that it is identical on Debian: .net - How pkg-config decides which look up path to add by default? - Stack Overflow
You can do the same test.

PKG_CONFIG_PATH is indeed the correct way to add such non-standard paths for pkg-config.