Vector Statistical Library - Math Kernel Library
Question
Could anyone explain me (in plain English) how to link the Vector Statistical Library (included in the Math Kernel Library) to a Fortran 90 source code compiling with Intel Fortran compiler for Linux?
My makefile looks as follows:
f90comp = ifort
libdir = /home/project/
mklpath = /opt/intel/mkl/10.0.5.025/lib/32/
mklinclude = /opt/intel/mkl/10.0.5.025/include/
exec: AAA.o
$(f90comp) -o AAA -L$(mklpath) -I$(mklinclude) AAA.o -libmkl_ia32.a -lguide -lpthread
AAA.o: $(libdir)AAA.f90
$(f90comp) -c -L$(mklpath) -I$(mklinclude) $(libdir)AAA.f90 -libmkl_ia32.a -lguide -lpthread
It produces the following error:
ld: cannot find -libmkl_ia32.a
make: *** Error 1
However, the file exists in the specified directory (mklpath).
Thanks!!
Solution
How is the file really called? -l to the linker is not meant to take a real file name. It is meant to take [x], while the file to be found then is called lib[x].{so,a}.
If you want to give the real object file name, you may either just append it without using -l and using the absolute path, or use -l:[filename].
I assume the right way to do it for you is -lmkl_ia32
however. Raw filenames are only useful if the lib is not called lib[x].{so,a}