Solved How can add mkl static lib to the project?
-
I want to attach the static Intel mkl (.a) library to my project so that it can be run on another computer without installing mkl
I copy .a libs and include in my project directory and choose the libmkl_intel_lp64.a with external library
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/release/ -lmkl_intel_lp64 else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/debug/ -lmkl_intel_lp64 else:unix: LIBS += -L$$PWD/lib/ -lmkl_intel_lp64 INCLUDEPATH += $$PWD/include DEPENDPATH += $$PWD/include win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/lib/release/libmkl_intel_lp64.a else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/lib/debug/libmkl_intel_lp64.a else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/lib/release/mkl_intel_lp64.lib else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/lib/debug/mkl_intel_lp64.lib else:unix: PRE_TARGETDEPS += $$PWD/lib/libmkl_intel_lp64.a
But I get these errors when I build project:
_malloc.c:-1: error: undefined reference to `mkl_serv_malloc' dftisetvalue.c:-1: error: undefined reference to `mkl_serv_strnlen_s' dfticreatedescriptor_d_md.c:-1: error: undefined reference to `mkl_dft_dfti_create_dcmd' .............
How can add mkl static lib to the project?
-
Hi,
Did you check that you are linking all the required libraries ?
AFAIR mkl is not just one single library. Check which one provides that symbol.
-
@SGaist There is no error when I add .so to my project as below
unix { INCLUDEPATH += /opt/intel/mkl/include LIBS += -L/opt/intel/mkl/lib/intel64 \ -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \ -L/opt/intel/lib/intel64 \ -liomp5 -lpthread -dl -lm } else:win32{ INCLUDEPATH += /opt/intel/mkl/include LIBS += -L/opt/intel/mkl/lib/intel64 \ -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core \ -L/opt/intel/lib/intel64 \ -liomp5 -lpthread -dl -lm }
how can change this to (.a) lib?
(I have both .a and .so in lib file) -
As a said earlier: check which of the mkl library provides the missing symbols and link to them as well.
@zhmh said in How can add mkl static lib to the project?:
mkl_serv_malloc
-
I found this advisor and used it for link MKL lib to my project and it worked fine!
-
What did you use in the end ?
-
This:
win32:CONFIG(release, debug|release): LIBS += -Wl,--start-group $$PWD/../MKL/lib/libmkl_intel_ilp64.a $$PWD/../MKL/lib/libmkl_sequential.a \ $$PWD/../MKL/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl else:win32:CONFIG(debug, debug|release): LIBS += -Wl,--start-group $$PWD/../MKL/lib/libmkl_intel_ilp64.a $$PWD/../MKL/lib/libmkl_sequential.a \ $$PWD/../MKL/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl else:unix: LIBS += -Wl,--start-group $$PWD/../MKL/lib/libmkl_intel_ilp64.a $$PWD/../MKL/lib/libmkl_sequential.a \ $$PWD/../MKL/lib/libmkl_core.a -Wl,--end-group -lpthread -lm -ldl INCLUDEPATH += $$PWD/../MKL/include DEPENDPATH += $$PWD/../MKL/include