Question

I am trying to use libfann version 2.0.1 instead of the newest version 2.2.0, but could not figure out how to do so. Any thoughts on how to do that?

normally that works perfectly:

gcc fann_calculator.c -o run_fann_calculator -lfann -lm

where fann_calculator.c contains a program that calls a neural network.

Thanks

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top