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

C/C++ Link error when LAPACK and BLAS is used

danesh_d
Beginner
1,377 Views

I have used few BLAS and LAPACK functions in my code on OpenSUSE (64-bit). The code is compiled successfully but when the linking is in process, unresolved error message is shows. I have tried to add new compiler switches but the erorr is not solved. I also ran the environtment script from tools folder at MKL directory. The output I get is:

make all-recursive
make[1]: Entering directory `/home/danesh/TEST/MKL'
Making all in doc
make[2]: Entering directory `/home/danesh/TEST/MKL/doc'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/danesh/TEST/MKL/doc'
Making all in include
make[2]: Entering directory `/home/danesh/TEST/MKL/include'
make[2]: Nothing to be done for `all'.
make[2]: Leaving directory `/home/danesh/TEST/MKL/include'
Making all in src
make[2]: Entering directory `/home/danesh/TEST/MKL/src'
/opt/intel/cce/10.1.018/bin/icc -O3 -openmp -parallel -ipo -mp -static -w -o mycode routines.o computation.o comp_wrapper.o util.o functions.o regexp.o model.o parser.o takeNum.o numCourse.o -L/opt/intel/mkl/10.0.5.025/lib/em64t/ -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_solver_lp64 -lmkl_lapack -lmkl_em64t -lmkl_core -lguide -lpthread -lm
ipo: warning #11043: unresolved _ZNSt8ios_base4InitD1Ev
Referenced in /tmp/ipo_icckS9VB5.o
ipo: warning #11043: unresolved _ZTVN10__cxxabiv120__si_class_type_infoE
Referenced in /tmp/ipo_icckS9VB5.o
ipo: warning #11043: unresolved _ZTVN10__cxxabiv117__class_type_infoE
Referenced in /tmp/ipo_icckS9VB5.o
ipo: warning #11043: unresolved _ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
Referenced in /tmp/ipo_icckS9VB5.o
ipo: warning #11043: unresolved _ZSt5flushIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_
Referenced in /tmp/ipo_icckS9VB5.o
ipo: warning #11043: unresolved __cxa_pure_virtual

and many other unresolved error. I can successfully compile example files. but my own code can not be compiled. Does anybody know what this happens?

Thanks in advance,

D.

0 Kudos
4 Replies
Andrey_Bespalov
New Contributor I
1,377 Views

The errorsare ipo (inter procedural optimization) faults, so it is hardly connected with MKL. Could you try to build without -ipo option?

0 Kudos
danesh_d
Beginner
1,377 Views

The errorsare ipo (inter procedural optimization) faults, so it is hardly connected with MKL. Could you try to build without -ipo option?

Well I did and now I get these errors:

FieldCalculator.cpp:(.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_[.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_]+0x1fe): undefined reference to `__cxa_end_catch'
FieldCalculator.cpp:(.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_[.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_]+0x210): undefined reference to `operator delete(void*)'
FieldCalculator.cpp:(.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_[.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_]+0x226): undefined reference to `std::__throw_bad_alloc()'
FieldCalculator.cpp:(.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_[.gnu.linkonce.t._ZNSt6vectorIS_I13complexVectorSaIS0_EESaIS2_EE9push_backERKS2_]+0x22b): undefined reference to `std::__throw_bad_alloc()'

the interesting thing is that I have not used any of MKL libraries in "FieldCalculator.cpp" so I don't know what linker is complaining about.

Thanks,

D.

0 Kudos
TimP
Honored Contributor III
1,377 Views

It looks liike you are trying to compile and link C++ code, but are using the icc C compiler. The C++ compiler is icpc, which will be capable of C++, and, to a limited extent, C.

0 Kudos
danesh_d
Beginner
1,377 Views
Quoting - tim18

It looks liike you are trying to compile and link C++ code, but are using the icc C compiler. The C++ compiler is icpc, which will be capable of C++, and, to a limited extent, C.

Yes you are right, I used "icpc" instead but I still got errors about unresolved reference to MKL functions that I used. So I copied path to libraries from examples (LIB=...) and it worked finally. Thanks for your hints.

D.

0 Kudos
Reply