0

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

MHardy
  • 491
  • 3
  • 7
  • 17
  • 4
    and the errors you're getting are...... – KevinDTimm Oct 26 '12 at 17:52
  • Are both libraries installed? How do you know you're not getting the result you want? – Brian Cain Oct 26 '12 at 17:52
  • the error I get is about a feature in the newest version: FANN Error 4: Error reading "cascade_min_out_epochs" from configuration file "/home/sifa/Desktop/CE//fann_network.net". Segmentation fault (core dumped) – MHardy Oct 26 '12 at 17:59
  • @BrianCain yes both of the libraries are installed and I wanted to use the older one. – MHardy Oct 26 '12 at 18:00

1 Answers1

6

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

Basile Starynkevitch
  • 223,805
  • 18
  • 296
  • 547