Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
7267 Discussions

Help: undefined refenerce when using IFort 9.1 .043 and MKL 9.1.021 to compile

xiaofang79
Débutant
858 Visites
Dear all,

I am a new user to ifort and mkl. When I try to use the following setting to compile , it keeps generating undefined reference error:

O Compiler options: -FR -mp1 -w -prec_div -pad -ip
L Linker Flags: -no-ipo -L/opt/intel/fc/9.1.043/lib -i-static -openmp -lsvml
P Preprocessor flags '-DParallel'
R R_LIB (LAPACK+BLAS): -L/opt/intel/mkl/9.1.021/lib/32 -lmkl_ia32 -lmkl_lapack -lguide


compile log:
rm -f *.o _tmp_.* *.P .real .complex *~ *.mod
if [ -f .complex ]; then
make clean;
fi
touch .real
make TYPE='REAL' TYPE_COMMENT='!_REAL' ./aim
make[1]: Entering directory `/home/xiaolin79/Desktop/wien2k/wien2k/SRC_aim'
moduls.frc: REAL version extracted
ifort -FR -mp1 -w -prec_div -pad -ip -c moduls_tmp.f
mv moduls_tmp.o moduls.o
rm moduls_tmp.f
ifort -FR -mp1 -w -prec_div -pad -ip -c charge.f
ifort -FR -mp1 -w -prec_div -pad -ip -c gbass.f
ifort -FR -mp1 -w -prec_div -pad -ip -c gener.f
...........
critic.o surf.o integrho.o follow.o interp.o cputim.o jacobi.o ludcmp.o spline.o doit.o dtdtylm.o sumdd.o hrhosphe.o matprod.o readcs.o dipole.o rho.o cossin.o intlib.o davint.o d1mach.o sortag.o follown.o SplineFit.o CheckCSpline.o -no-ipo -L/opt/intel/fc/9.1.043/lib -i-static -openmp -lsvml -L/opt/intel/mkl/9.1.021/lib/32 -lmkl_ia32 -lmkl_lapack -lguide
/opt/intel/mkl/9.1.021/lib/32/libmkl_lapack.so: undefined reference to `chemm'
/opt/intel/mkl/9.1.021/lib/32/libmkl_lapack.so: undefined reference to `dtbsv'
/opt/intel/mkl/9.1.021/lib/32/libmkl_lapack.so: undefined reference to `dgemv'
/opt/intel/mkl/9.1.021/lib/32/libmkl_lapack.so: undefined reference to `dpotrf_u_small'
........


Thanks for your kind help.




0 Compliments
1 Répondre
TimP
Contributeur émérite III
858 Visites
I would suggest you replace your link options from -lsvml on by
-xW /opt/intel/mkl/9.1.021/lib/32/libmkl_lapack.a /opt/intel/mkl/9.1.021/lib/32/libmkl_ia32.a
For the following reasons:
a) lapack depends on BLAS functions contained in the base MKL library, so the library search order is important. That is related to the error you show.
b) if you are linking static against all ifort libraries, you should not be linking dynamic against the MKL copy of libguide.so. That could conflict with the ifort libguide.a (which is already included by -openmp). If you really mean to use MKL dynamic libraries, change .a to .so, but don't request a search for libguide.so.
c) the effect of -xW is to ask ifort to link against svml libraries in the supported manner.

Further comment:
Option -mp1 is obsolete from ifort 9.1 on. You could remove -mp1 -prec_div and use -fp-model precise -ftz, if you are looking for standards compliance except for abrupt underflow. None of these options have any effect at link time.
0 Compliments
Répondre