Basic linking problem LAPACK95

Basic linking problem LAPACK95

Using MKL on Linux for IA-32:
I need myprog.f90 to be statically linked; it makes a call to the LAPACK subroutine gels() using the LAPACK95 interface.

I have spent a lot of time looking at documentation, examples and similar questions on this forum; but after much experimentation I still can't get this to compile. So I appologize but I must go ahead and ask again.

My best attempt based on Intel's Link Advisor:
ifort -L/opt/intel/mkl/10.2.1.017/lib/32 -lmkl_blas95 -lmkl_lapack95 -lmkl_intel -lmkl_core -lmkl_sequential -lpthread -static myprog.f90

Result:
/tmp/ifortJnhkQs.o: In function `MAIN__':
myprog.f90:(.text+0x375): undefined reference to `sgels1_mkl95_'

I have built the interface *.mod and *.a files for LAPACK95.

Do I have the wrong compiler command?
I can compile from the MKL LAPACK95 included examples (using the makefile) so I guess the problem is not some environmental variable. I don't know enough to extract the technique from the example makefile.

3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I based the following on the makefile output when compiling the example file for the gels routine. It seems to work; there is probably some extra stuff in there.

ifort -xK -O3 -static -I /opt/intel/Compiler/11.1/046/mkl/include/32 -w myprog.f90 /opt/intel/Compiler/11.1/046/mkl/lib/32/libmkl_lapack95.a "/opt/intel/Compiler/11.1/046/mkl/lib/32"/libmkl_intel.a -Wl,--start-group "/opt/intel/Compiler/11.1/046/mkl/lib/32"/libmkl_intel_thread.a "/opt/intel/Compiler/11.1/046/mkl/lib/32"/libmkl_core.a -Wl,--end-group -L"/opt/intel/Compiler/11.1/046/mkl/lib/32" -openmp -liomp5 -lpthread -o myprog.out

Quoting - sarah_a
I based the following on the makefile output when compiling the example file for the gels routine. It seems to work; there is probably some extra stuff in there.

ifort -xK -O3 -static -I /opt/intel/Compiler/11.1/046/mkl/include/32 -w myprog.f90 /opt/intel/Compiler/11.1/046/mkl/lib/32/libmkl_lapack95.a "/opt/intel/Compiler/11.1/046/mkl/lib/32"/libmkl_intel.a -Wl,--start-group "/opt/intel/Compiler/11.1/046/mkl/lib/32"/libmkl_intel_thread.a "/opt/intel/Compiler/11.1/046/mkl/lib/32"/libmkl_core.a -Wl,--end-group -L"/opt/intel/Compiler/11.1/046/mkl/lib/32" -openmp -liomp5 -lpthread -o myprog.out

-xK isn't documented for any recent compiler version. It's supposed to be equivalent to -mia32 for 11.x, after being unreliable for 10.x. So it would prevent any SSE optimization in myprog.f90.
Yes, there is duplication; the -L path should already be set by the ifortvars script, and -liomp5 -lpthread are already include in -openmp.

Leave a Comment

Please sign in to add a comment. Not a member? Join today