My objective is to link my object with the static lib files like
opt/intel/mkl/lib/intel64/libmkl_intel_ilp64.a
opt/intel/mkl/lib/intel64/libmkl_sequential.a
opt/intel/mkl/lib/intel64/libmkl_core.a
I have add some codes in my codes target_link_libraries functions like target_link_libraries(objects MKLROOT.a)
The make command is:
cmake -DBLA_STATIC=ON …(no error)
make install(error)
The error message is:
opt/intel/mkl/lib/intel64/libmkl_core.a(dsytrf.o): In function ‘mkl_lapack_dsytrf’:
dsytrf_gen.f:(.test+0x430): undefined reference to “mkl_lapack_dlasyf”
dsytrf_gen.f:(.test+0x6a5): undefined reference to “mkl_lapack_dlasyf”
opt/intel/mkl/lib/intel64libmkl_core.a(dsygst.o): In function ‘mkl_lapack_dsygst’:
dsygst_gen.f:(.test+0x320): undefined reference to “mkl_blas_dsyr2k”
dsygst_gen.f:(.test+0x675): undefined reference to “mkl_blas_dsyr2k”
…
I have not pasted all error functions. All the errors point to the same static lib file:opt/intel/mkl/intel64/libmkl_core.a.
I have obtained some help from https://www.intel.cn/content/www/cn/zh/developer/tools/oneapi/onemkl-link-line-advisor.html. After many attempts, cmake(cmake -DBLA_STATIC=ON …) and make still exists error.
I am very confused that I have added
-Wl,–start-group
opt/intel/mkl/lib/intel64/libmkl_intel_ilp64.a
opt/intel/mkl/lib/intel64/libmkl_sequential.a
opt/intel/mkl/lib/intel64/libmkl_core.a
-Wl,–end-group
in the function target_link_libraries(object lib) in the CMakeLists.txt of the object file.
Is it possible that I should add the MKLROOT file to other sub-objects linked by the current top-object? In fact I have added the three MKLROOT file into target_link_libraries(sub-objects MKLROOT.a) of all sub-objects. And the error still occurs.
I don’t know what happens and which file should I review or recheck to find the error comes from?