I have Ubuntu 14.04 upgraded from 12.04 making dist-upgrades. I did many manual installations such as ffmpeg, libglib and so on, in the past. I have a nice custom distro now, it works well but I have problems while trying to compile applications. It stems from library conflicts between manually installed packages from source code and native distro libraries. A guy advised me to rename /usr/local
it works but boot failed on next reboot.
When I look for directories added by pkg-config
with
pkg-config --variable pc_path pkg-config
it lists
/usr/local/lib/i386-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/i386-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
I don't want it to look for paths in /usr/local/lib...
How can I ban those paths not to let pkg-config
look for?
Best Answer
Stuff in
/usr/local
usually supersedes stuff in/usr
, so I'm a bit confused as to why you would install libraries there to have a "a nice custom distro", but then not want to compile against them. Those are the libraries the system will use actually use.Anyway,
man pkg-config
claims the base search path:This implies they are compiled in. I notice it is different on ubuntu than fedora -- the former is long and inclusive, whereas the latter is short and exclusive; on fedora I have to set a
$PKG_CONFIG_PATH
to include/usr/local
.Since paths in
$PKG_CONFIG_PATH
are checked first, you could just set:The fact that these are at the end of the built-in paths won't matter; if the check makes it to there without finding anything, there's nothing to be found.
To demonstrate how this works, create a temporary directory
/opt/bs/pkg
and copy a.pc
file from one of the directories in the default path into it -- e.g.,alsa.pc
. First check;Now go into
/opt/bs/pkg/alsa.pc
and change-lasound
(it's in theLibs:
field) to-foobar
. Set$PKG_CONFIG_PATH
and try again:Eureka,
$PKG_CONFIG_PATH
has overridden the built-in paths...you can delete/opt/bs/pkg
, of course.