Some useful pkg-config tricks
Jef Driesen
jefdriesen at telenet.be
Wed Oct 9 02:16:29 UTC 2013
Hi,
I've noticed people are having trouble with pkg-config not finding
libraries (e.g. libdivecomputer) installed to non-standard locations, or
when cross-compiling. I'm not sure if you are aware of this, but
pkg-config supports environment variables to influence its search path:
http://linux.die.net/man/1/pkg-config
PKG_CONFIG_PATH
Use this variable to specify additional directories to add to the
default search path. This is very convenient if you have installed
libraries to a non-default location. For example if you have installed
libdivecomputer to $HOME/local, you can do:
export PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig
and then pkg-config will find libdivecomputer there.
PKG_CONFIG_LIBDIR
Use this variable to replace the default pkg-config search directory.
This is useful when cross-compiling. Normally the pkg-config of the host
system will search packages for the host system, and that's not what you
want. With PKG_CONFIG_LIBDIR, you can override the default directory and
force pkg-config to search in a different directory. For example if you
use mingw as a cross-compiler and install the windows packages to
$HOME/windows, you can do:
export PKG_CONFIG_LIBDIR=$HOME/windows/lib/pkgconfig
and then pkg-config will only search there.
Jef
More information about the subsurface
mailing list