Я пытаюсь создать CMAKE
для построения Visual Studio 2017 x64
решения, в котором я использую несколько Intel MKL
функций для вычисления инверсии общей матрицы с использованием LU decomposition
. Я получаю следующие ошибки при сборке проекта:
Error LNK2005 mkl_serv_allocate already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_memory_patched.obj)
Error LNK2005 mkl_serv_malloc already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_memory_patched.obj)
Error LNK2005 mkl_serv_deallocate already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_memory_patched.obj)
Error LNK2005 mkl_serv_free already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_memory_patched.obj)
Error LNK2005 mkl_serv_format_print already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_msg_support.obj)
Error LNK2005 mkl_serv_inspector_suppress already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_semaphore.obj)
Error LNK2005 mkl_serv_inspector_unsuppress already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_semaphore.obj)
Error LNK2005 mkl_serv_thread_yield already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_semaphore.obj)
Error LNK2005 mkl_serv_unlock already defined in mkl_intel_thread_dll.lib(mkl_intel_thread.dll) test C:\Users\user1\test\build\mkl_core.lib(mkl_semaphore.obj)
Error LNK2019 unresolved external symbol __kmpc_global_thread_num referenced in function mkl_lapack_dgetrf test C:\Users\test\build\mkl_intel_thread.lib(dgetrf_par.obj)
Error LNK2001 unresolved external symbol __kmpc_global_thread_num test C:\Users\test\build\mkl_intel_thread.lib(d__scal_drv.obj)
Error LNK2019 unresolved external symbol __kmpc_ok_to_fork referenced in function mkl_lapack_dgetrf test C:\Users\test\build\mkl_intel_thread.lib(dgetrf_par.obj)
Error LNK2001 unresolved external symbol __kmpc_ok_to_fork test C:\Users\test\build\mkl_intel_thread.lib(d__scal_drv.obj)
Error LNK2019 unresolved external symbol __kmpc_push_num_threads referenced in function mkl_lapack_dgetrf test C:\Users\test\build\mkl_intel_thread.lib(dgetrf_par.obj)
Error LNK2001 unresolved external symbol __kmpc_push_num_threads test C:\Users\test\build\mkl_intel_thread.lib(d__scal_drv.obj)
Error LNK2019 unresolved external symbol __kmpc_fork_call referenced in function mkl_lapack_dgetrf test C:\Users\test\build\mkl_intel_thread.lib(dgetrf_par.obj)
Error LNK2001 unresolved external symbol __kmpc_fork_call test C:\Users\test\build\mkl_intel_thread.lib(d__scal_drv.obj)
Error LNK2019 unresolved external symbol __kmpc_serialized_parallel referenced in function mkl_lapack_dgetrf test C:\Users\test\build\mkl_intel_thread.lib(dgetrf_par.obj)
Error LNK1120 16 unresolved externals test C:\Users\user1\test\build\Debug\test.exe
Это из-за следующего CMAKE?
cmake_minimum_required(VERSION 3.11)
PROJECT(MYPROJECT)
set(MKL_INCLUDE_DIRS "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/include")
set(MKL_LIBRARIES "C:/Program Files (x86)/IntelSWTools/compilers_and_libraries/windows/mkl/lib/intel64")
include_directories(${MKL_INCLUDE_DIRS})
add_executable(test MACOSX_BUNDLE)
target_link_libraries(
test
${MKL_LIBRARIES}/mkl_blas95_ilp64.lib"
${MKL_LIBRARIES}/mkl_blas95_lp64.lib"
${MKL_LIBRARIES}/mkl_core.lib"
${MKL_LIBRARIES}/mkl_core_dll.lib"
${MKL_LIBRARIES}/mkl_intel_ilp64.lib"
${MKL_LIBRARIES}/mkl_intel_ilp64_dll.lib"
${MKL_LIBRARIES}/mkl_intel_lp64.lib"
${MKL_LIBRARIES}/mkl_intel_lp64_dll.lib"
${MKL_LIBRARIES}/mkl_intel_thread.lib"
${MKL_LIBRARIES}/mkl_intel_thread_dll.lib"
${MKL_LIBRARIES}/mkl_lapack95_ilp64.lib"
${MKL_LIBRARIES}/mkl_lapack95_lp64.lib"
${MKL_LIBRARIES}/mkl_rt.lib"
${MKL_LIBRARIES}/mkl_sequential.lib"
${MKL_LIBRARIES}/mkl_sequential_dll.lib"
${MKL_LIBRARIES}/mkl_tbb_thread.lib"
${MKL_LIBRARIES}/mkl_tbb_thread_dll.lib"
У меня есть папка bin
, содержащая DLL
s в системе PATH
:
C:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2019.0.117\windows\redist\intel64_win\mkl