Linking with Local Libraries

Decided to post this here for the benefit of others.

In response to a question I asked on the cairo list last year, Ross McFarland responded with instructions on how to link against a special development version of a library rather than the one installed on your system. The most important bit is this:

you can set the following:
    PKG_CONFIG_PATH=$HOME/local/lib/pkgconfig
    LD_LIBRARY_PATH=$HOME/local/lib
    export PKG_CONFIG_PATH LD_LIBRARY_PATH

and then configure modules to install as such:
    ./configure --prefix=$HOME/local

Thanks Ross!

Note: this works best with libraries which use pkg-config. You’ll need to use PKG_CONFIG_PATH and LD_LIBRARY_PATH both when building the custom modules and when building your application itself. If a custom library doesn’t use pkg-config, you’ll need to explicitly specify the library and include paths with -I and -L in CFLAGS or CXXFLAGS and LDFLAGS respectively.

hoodwink.d enhanced