Hello. crossdev-pkg-config makes cross-compiling against some packages from the tree unnecessarily hard. For example, I'm positive most people who have raspberry-pi want to cross-compile packages for it. media-libs/raspberrypi-userland installs into /opt, including pkgconfig files which go to /opt/vc/lib/pkgconfig. crossdev-pkg-config nukes PKG_CONFIG_PATH. Fine. crossdev-pkg-config nukes EXTRA_PKG_CONFIG_LIBDIR. What? I have seen bug 310807 and sadly it was closed without a proper fix. Here's a simple test: (crossdev) ~ # /usr/bin/arm-unknown-linux-gnueabi-pkg-config --cflags bcm_host Package bcm_host was not found in the pkg-config search path. Perhaps you should add the directory containing `bcm_host.pc' to the PKG_CONFIG_PATH environment variable No package 'bcm_host' found (crossdev) ~ # PKG_CONFIG_PATH=/usr/arm-unknown-linux-gnueabi/opt/vc/lib/pkgconfig /usr/bin/arm-unknown-linux-gnueabi-pkg-config --cflags bcm_host Package bcm_host was not found in the pkg-config search path. Perhaps you should add the directory containing `bcm_host.pc' to the PKG_CONFIG_PATH environment variable No package 'bcm_host' found (crossdev) ~ # EXTRA_PKG_CONFIG_LIBDIR=/usr/arm-unknown-linux-gnueabi/opt/vc/lib/pkgconfig /usr/bin/arm-unknown-linux-gnueabi-pkg-config --cflags bcm_host Package bcm_host was not found in the pkg-config search path. Perhaps you should add the directory containing `bcm_host.pc' to the PKG_CONFIG_PATH environment variable No package 'bcm_host' found (crossdev) ~ # PKG_CONFIG_PATH=/usr/arm-unknown-linux-gnueabi/opt/vc/lib/pkgconfig /usr/bin/pkg-config --cflags bcm_host -DUSE_VCHIQ_ARM -I/opt/vc/include -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/vcos/pthreads Please fix.
This is with crossdev-99999999 @ 8b1b79e02cc36bc6f2b5583db6aeea333fb8d59b.
Created attachment 461652 [details, diff] 0001-cross-pkg-config-preserve-EXTRA_PKG_CONFIG_LIBDIR.patch
Here's a git formatted patch that fixes EXTRA_PKG_CONFIG_LIBDIR handling and allows me to successfully cross-compile against media-libs/raspberrypi-userland.
Tl;DR: I'm not sure EXTRA_PKG_CONFIG_LIBDIR is the correct wa to expose it. Should we allow overriding PKG_CONFIG_PATH instead in a smarter way? Mike, WDYT? Long version: I'm not very familiar with pkg-config ways of looking up packages. Is PKG_CONFIG_LIBDIR the correct variable to override in general? It sounds like PKG_CONFIG_PATH is what you really need (crossdev also filters PKG_CONFIG_PATH out). raspberrypi-userland even tries to set PKG_CONFIG_PATH (without ${ROOT}) etc/env.d/04raspberrypi-userland:PKG_CONFIG_PATH='/opt/vc/lib/pkgconfig' but there is no way to prepend ${ROOT}/${SYSROOT} to it (or is there?) crossdev does a crude thing: etc/portage/make.conf:PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/" Does it work given the unset in cross-pkg-config? Only media-video/mpv in ::gentoo tries to attempt to use EXTRA_PKG_CONFIG_LIBDIR and I guess it does not work for years. I see your change mostly touches uclinux code branch. Do you use it? I'm not sure what uclinux is WRT this code. Unsetting EXTRA_PKG_CONFIG_LIBDIR was added long ago in https://gitweb.gentoo.org/proj/crossdev.git/commit/wrappers/cross-pkg-config?id=8f6b30809941541bf7389bda55e5c8eb2bdb2b9f EXTRA_PKG_CONFIG_LIBDIR is crossdev-only wrapper variable, not a pkg-config specific variable. I'm not sure it's a good idea to expose it as an API.
Perhaps it would help if you post exact steps you want to work: 1. crossdev command to build a ${SYSROOT} 2. cross-emerge command to build a package 3. build log of a failure Then it should be easier for me to understand what is lacking here.