Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7942 Discussions

undefined reference to __svml_cos2 while linking with Intel C++ 11.1

Christian_W_2
Beginner
1,680 Views

Hello,

I am trying to create an executable file with Intel Fortran and Intel C++ 11.1. Compilers. I can create my own subroutines in a commercial program by using Fortran routines. The objects are further passed to C++  in order to create an executable and finally linked with some standard objects created by the another Fortran compilation. 

In the final linking however there is the error message to an undefined reference: 

"undefined reference to `__svml_cos2"

So, how do I properly include this mathematical library in my linking?

BR,



Christian 



Here is the full error message:

Linking: ...fepost.exe
Link command: icpc
Link arguments: ['-cxxlib', ... '']
.../UEL-C0Z-UTILS.o: In function `k_lagc_ttfunc_':
UEL-C0Z-UTILS.f:(.text+0x4bf2): undefined reference to `__svml_cos2'
UEL-C0Z-UTILS.f:(.text+0x4cc4): undefined reference to `__svml_cos2'



Here are my compiling and linking options:


compile_fortran = (fortCmd + " -c -fPIC -extend_source -xSSE4.2 -axSSE4.2 -w90 -w95 " + 
                  "-I$(MKLROOT)/include/intel64/lp64 -I$(MKLROOT)/include " + 
                  "-auto-scalar -WB -I%I")


compile_cpp = (cppCmd +
               " -c -cxxlib -Kc++eh -fPIC "                                   +

         "-Krtti -Kc++ -pc64 -restrict -DABQ_LINUX -DABQ_LNX86_64 "     +

         "-DFOR_TRAIL -DHAS_BOOL -DASSERT_ENABLED -D_BSD_TYPES "        +

               "-D_BSD_SOURCE -D_GNU_SOURCE -D_POSIX_SOURCE "                 +
               "-D_XOPEN_SOURCE_EXTENDED -D_XOPEN_SOURCE -DHAVE_OPENGL "      +
               "-DHKS_OPEN_GL -DTYPENAME=typename -DGL_GLEXT_PROTOTYPES "     +
               "-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -we1011 -we120 " +
               "-we117 -we556 -we144 -we268 -we1224 -we167 -we880 -O0 -I%I" )


link_sl = (fortCmd +
           " -cxxlib -fPIC -threads -shared " +
           "%E -Wl,-soname,%U -o %U %F %A %L %B -Wl,-Bdynamic " +
           "-shared-intel -lifport -lifcoremt "+
           ".../UEL-C0Z-PVD.o "+
           ".../UEL-C0Z-RMVT.o "+
           ".../UEL-C0Z-MUSTCO.o "+
           ".../UEL-C0Z-UTILS.o "+
   " -lmkl_lapack95_lp64")



link_exe = (cppCmd + " -cxxlib -fPIC "  +
            "-Wl,-Bdynamic -i-dynamic -o %J %F %M %L %B %O -lpthread " +
            ".../UEL-C0Z-MUSTCO.o " +
            ".../UEL-C0Z-UTILS.o ")

0 Kudos
2 Replies
TimP
Honored Contributor III
1,680 Views

Your final link command should include the libsvml from the Intel compiler library.  With the 32-bit compiler, svml would not be included with a -mia32 option (which at one time was the default), but I can't see a full explanation from what you posted.

If you add the -# command to the icpc options if using icpc for the final link, you should see which libraries are searched.  I think it's impossible to debug your link script without displaying how it expands when run.  -lsvml should appear in the expansion of the compiler command for linking.

0 Kudos
Christian_W_2
Beginner
1,680 Views

In fact, without adding it to the options, the lsvm library is in the list of the libraries called. Further it seems to be called from the right intel64 directory. 

ld \
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crt1.o \
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crti.o \
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/crtbegin.o \
--eh-frame-hdr \
-dynamic-linker \
/lib64/ld-linux-x86-64.so.2 \
-o \
/home/.../fepost.exe \
-Bdynamic \
-L/abaqus68/6.8-1/exec/lbr \
-L/abaqus68/6.8-1/External \
-lstandardB \
-lABQDDB_Odb \
-lABQDDB_ODB_API \
-lABQDDB_Core \
-lABQDDB_CoreGeometry \
-lABQDDB_GeometricAttributes \
-lABQDDB_NonGeometricAttributes \
-lABQUTI_BasicUtils \
-lABQUTI_CoreUtils \
-lABQCAE_StableTime \

-lpthread \

-L/opt/intel/mkl/composer_xe_2011_sp1.6.233/compiler/lib/intel64 \
-L/opt/intel/mkl/composer_xe_2011_sp1.6.233/mkl/lib/intel64 \
-L/opt/intel/fortran/Compiler/11.1/073/lib/intel64 \
-L/opt/intel/cpp/Compiler/11.1/073/lib/intel64 \
-L/opt/intel/cpp/Compiler/11.1/073/ipp/em64t/lib \
-L/opt/intel/cpp/Compiler/11.1/073/tbb/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/lib \
-L/opt/intel/cpp/Compiler/11.1/073/lib/intel64 \
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6 \
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64 \
-L/lib/../lib64 \
-L/usr/lib/../lib64 \
-L/opt/intel/mkl/composer_xe_2011_sp1.6.233/compiler/lib/intel64 \
-L/opt/intel/mkl/composer_xe_2011_sp1.6.233/mkl/lib/intel64 \
-L/opt/intel/fortran/Compiler/11.1/073/lib/intel64 \
-L/opt/intel/cpp/Compiler/11.1/073/lib/intel64 \
-L/opt/intel/cpp/Compiler/11.1/073/ipp/em64t/lib \
-L/opt/intel/cpp/Compiler/11.1/073/tbb/intel64/cc4.1.0_libc2.4_kernel2.6.16.21/lib \
-L/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../.. \
-L/lib64 \
-L/lib \
-L/usr/lib64 \
-L/usr/lib \
-limf \
-lsvml \
-lm \
-lipgo \
-ldecimal \
-lstdc++ \
-lgcc_s \
-lgcc \
-lintlc \
-lc \
-lgcc_s \
-lgcc \
-lirc_s \
-ldl \
-lc \
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/crtend.o \
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../lib64/crtn.o

 

0 Kudos
Reply