I am fairly new to programming. i have installed armadillo library using installation instructions in install file supplied with library.
i have installed cmake LAPACK and BLAS using following commands
sudo apt-get install cmake
sudo apt-get install liblapack-dev
sudo apt-get install libblas-dev
after that i have installed using following commands
cmake .
make
sudo make install
Then after compiling example program i am getting this error
g++ example1.cpp -o example1 -O2 -larmadillo -llapack -lblas
ERROR:
/usr/bin/ld: warning: libmkl_rt.so, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libhdf5.so.101, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so, not found (try using -rpath or -rpath-link)
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fopen'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_INT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5check_version'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Ovisit'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Ldelete'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dget_space'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Gcreate2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Eget_auto2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_LLONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tinsert'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_SHORT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dread'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_UCHAR_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tequal'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Sget_simple_extent_ndims'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fis_hdf5'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fcreate'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Screate_simple'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_DOUBLE_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Sget_simple_extent_dims'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Lexists'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dopen2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tcopy'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dget_type'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_ULLONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_UINT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_FLOAT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Eset_auto2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_LONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Sclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5open'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_SCHAR_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Gopen2'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_USHORT_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dwrite'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Tcreate'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5T_NATIVE_ULONG_g'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Fclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Gclose'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libarmadillo.so: undefined reference to `H5Dcreate2
Solved
I have anaconda library installed in my home directory. So cmake is detecting intel MKL and other libraries from that folder. i have updated my LD_LIBRARY_PATH variable to include that folder and the issues are resolved.
Just add the following line to /.bashrc in case you have anaconda installed in folder
export LD_LIBRARY_PATH=/path_to_lib_folder/lib:$LD_LIBRARY_PATH