It depends upon where the two libraries sit. If they are installed in the same directory (e.g. both installed in /usr/lib/
) you'll probably get the youngest one.
I suggest to carefully read the ld.so(8) and ldd(1) man pages. You certainly can trace what library is loaded (with e.g. the LD_DEBUG
envirnonment variable). Don't forget to re-run ldconfig appropriately after library installation.
You could also play some LD_LIBRARY_PATH
trick; for instance, set it to $HOME/lib:/usr/lib
and install appropriate symlinks in your $HOME/lib/
to the precise library you want. For instance, you might do
ln -s /usr/lib/libfann.so.2.0.1 $HOME/lib/libfann.so.2
export LD_LIBRARY_PATH=$HOME/lib:/usr/lib:/lib
then check with ldd run_fann_calculator
that you get the expected [version of the] libfann
library.
Don't forget to read the Program Library Howto. You might want to pass appropriate flags to ld such as -rpath
. You may need to pass them using gcc
, perhaps with Gcc Link Options such as -Wl