In order to work around bug #202 ( https://sourceforge.net/p/itpp/bugs/202/ ), I tried to build IT++ 4.3.1 using the MKL v11 library provided by MATLAB.
First I exported LD_LIBRARY_PATH containing the path to mkl.so, i.e., I want to use /path/to/matlab/bin/glnxa64/mkl.so
Next, I run cmake as follows:
cmake -DCMAKE_INSTALL_PREFIX=/usr -DBLAS_LIBRARIES="/path/to/matlab/bin/glnxa64/mkl.so" -DLAPACK_LIBRARIES="/path/to/matlab/bin/glnxa64/mkl.so" -DFFT_LIBRARIES="/path/to/matlab/bin/glnxa64/mkl.so" ..
Next, building with make fails with the following error when linking:
Linking CXX shared library libitpp.so
/usr/bin/ld: cannot find -lmkl
collect2: error: ld returned 1 exit status
Hence, the linker seems to be unable to find mkl.so although I have exported LD_LIBRARY_PATH. Also copying mkl.so to the system's default library directory does not help (linking still fails with the same error).
Why does this procedure not work?
Is there any way using cmake to pass an -L option to the linker to provide the appropriate library directory?