Copies of FANN can be obtained from our Download page.
FANN is available under the terms of the GNU Lesser General Public License.
FANN bindings to several other programming languages is also available from the Language Bindings page.
Windows Installation
FANN includes prebuilt DLL and LIB files as well as prebuilt executables for some of the examples. To use these in your own project, simply reference the DLL/LIB files as well as the header files.
To compile FANN and the examples yourself, you will need Visual Studio 2010 or use the Cross Platform Install method described below.
To build the library and examples with Visual Studio 2010, first navigate to the VS2010 directory in the FANN distribution and open the fann.sln solution. In the Visual Studio menu bar, choose “Build” -> “Build Solution”. When the build process is complete, the library and examples can be found in the “bin” directory.
Cross Platform Install
The FANN cross platform install system is based on CMAKE and have been tested on ubuntu Linux and Mac OSX, but should work on other platforms too. Once you have installed CMAKE, you can execute the following commands, in the FANN directory, to compile and install FANN.
cmake .
sudo make install
Once you have installed the library you can test it out by going to the examples directory and type make runtest, which will compile the examples and run a few of them to test that everything is working.
Sometimes you want to install to a different location than the default /usr/local. You can do that by adding the CMAKE_INSTALL_PREFIX to cmake, by for example installing to /usr like this cmake -D CMAKE_INSTALL_PREFIX:PATH=/usr .
When all else fails
FANN is pretty simple and does not require a lot of extra stuff, so when all else fails, simply include the file doublefann.c or floatfann.c in your project and everything should work.
An example of how this is done can be seen in the rundebugtest target in examples/Makefile.
./xor_train: error while loading shared libraries: libfann.so.2: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127
what this error about?
I got the same error when installing in Ubuntu. Can any one help on this matter?
@Dek Wan :
You got this error because the /usr/local/lib isn’t in your library path, a simple solution could be to add a symbolic link to your actual library path, try this out :
$> ln -s /usr/local/lib/*fann* /usr/lib/
Actually installation was successful but when running the example given above gave this error
Training network
./xor_train
./xor_train: error while loading shared libraries: libfann.so.2: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127
Try this out :
$> ln -s /usr/local/lib/*fann* /usr/lib/
or simply copy by hand all the installed files in the /local/lib/library (if you didn’t change the install path) to the /usr/lib folder, it’s actually the simplest solution I got, with no need to change the library path of your system.
I install fann correctly, also xor example works fine. But I modify the xor.data in the example directory to be
5 2 1
1.200000 1.133333
0
1.266667 1.000000
0
1.266667 1.200000
0
2.066667 5.266667
1
0.594595 1.513514
2
Also, xor_train.c: max_epochs to be 500000. The others are the same. But the result is not that right:
XOR test (1.200000,1.133333) -> 0.014159, should be 0.000000, difference=0.014159
XOR test (1.266667,1.000000) -> 0.014159, should be 0.000000, difference=0.014159
XOR test (1.266667,1.200000) -> 0.014159, should be 0.000000, difference=0.014159
XOR test (2.066667,5.266667) -> 1.000000, should be 1.000000, difference=-0.000000
XOR test (0.594595,1.513514) -> 1.000000, should be 2.000000, difference=1.000000
Any ideas what should I do now? Many thanks.
To anyone seeing the error:
./xor_train: error while loading shared libraries: libfann.so.2: cannot open shared object file: No such file or directory
make: *** [runtest] Error 127
This happens when you install a shared library and don’t run ldconfig after. I was able to get it to work by running “sudo ldconfig” after installation.