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

Linking errors with mkl_intel_thread

ssylee
Beginner
3,359 Views
I have implemented helper functions that would call certain Lapack and BLAS functions to calculate matrix inverses, mat-mat multiplications, and mat-vec multiplications. However, when I'm linking with the intel MKL libraries, I keep on getting the following linker errors, which I have no idea how to solve. Any suggestions would be much appreciated.

1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_global_thread_num referenced in function _mkl_lapack_sgetrf_ib
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_global_thread_num
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_dispatch_init_4 referenced in function L__mkl_lapack_sgetrf_340__par_loop1
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_dispatch_next_4 referenced in function L__mkl_lapack_sgetrf_340__par_loop1
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol _omp_get_thread_num referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_barrier referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_critical referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_end_critical referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_ok_to_fork referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_ok_to_fork
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_push_num_threads referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_push_num_threads
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_push_num_threads
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_push_num_threads
1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_fork_call referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_fork_call
1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_serialized_parallel referenced in function L__mkl_lapack_sgetrf_243__par_region0
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_serialized_parallel
1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_end_serialized_parallel referenced in function _SGETRF_IB_OMP.
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_end_serialized_parallel
1>mkl_intel_thread.lib(sgetrf_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_dispatch_fini_4
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_for_static_init_4 referenced in function L__mkl_blas_sgemm_437__par_loop1
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_init_4
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_init_4
1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_init_4
1>mkl_intel_thread.lib(sgemm_omp.obj) : error LNK2019: unresolved external symbol ___kmpc_for_static_fini referenced in function L__mkl_blas_sgemm_437__par_loop1
1>mkl_intel_thread.lib(strsm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_fini
1>mkl_intel_thread.lib(strmm_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_fini
1>mkl_intel_thread.lib(sgetrf_ib_omp.obj) : error LNK2001: unresolved external symbol ___kmpc_for_static_fini
1>mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol _omp_in_parallel referenced in function _MKL_Get_Max_Threads
1>mkl_intel_thread.lib(mkl_threading.obj) : error LNK2019: unresolved external symbol _omp_get_max_threads referenced in function _MKL_Get_Max_Threads
1>C:\Robotics and Controls Laboratory\rcl_dicom2stradwin_mkl\branches\version-movenode\Debug/rcl_dicom2stradwin.exe : fatal error LNK1120: 17 unresolved externals
0 Kudos
8 Replies
TimP
Honored Contributor III
3,359 Views
As you have linked the t hreading library, you must also link the threading support (/Openmp if using Intel compiler, libiompxxx.lib if using VC9 or possibly VC8).
0 Kudos
ssylee
Beginner
3,359 Views
Quoting - tim18
As you have linked the t hreading library, you must also link the threading support (/Openmp if using Intel compiler, libiompxxx.lib if using VC9 or possibly VC8).

I'm not sure if this particular library is the problem, but I have changed my project settings in Visual Studio such that these libraries are linked:

mkl_intel_c.lib libmmdd.lib mkl_lapack.lib mkl_c_dll.lib mkl_intel_thread.lib mkl_core.lib libguide.lib

However, as I run through the program, when it reaches the sgemm function call which involves BLAS in MKL, I am getting this message as attached during run-time. As seen in the debugger, I got an exit code of 3 when the program returned from the main function. It would be great if someone can light up some recommendations if this is a common error of using MKL improperly. Thanks.


0 Kudos
Gennady_F_Intel
Moderator
3,359 Views
Thatt not good idea to link static and dynamic libraries at the same time.
What mkls version are you using? Ill get you the right way to do that but
I d recommend you to read mkls userguide you can find there all recommendation you need to link your application.
--Gennady

0 Kudos
ssylee
Beginner
3,359 Views
Thatt not good idea to link static and dynamic libraries at the same time.
What mkls version are you using? Ill get you the right way to do that but
I d recommend you to read mkls userguide you can find there all recommendation you need to link your application.
--Gennady


I'm using version 10.1 for the MKL and 11.0 for the compiler. Where would the recommendations be in the manual (or what term would you recommend me to search on msdn for the recommendation since the manual is integrated with msdn on my computer). Thanks.
0 Kudos
Gennady_F_Intel
Moderator
3,359 Views
1.mkls userguide (userguide.pdf) you can find this manual into the directory:
..Compiler11.0�66cppDocumentationmkl
2. the recommended linking line is the following:
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
--Gennady

0 Kudos
ssylee
Beginner
3,359 Views
1.mkls userguide (userguide.pdf) you can find this manual into the directory:
..Compiler11.0�66cppDocumentationmkl
2. the recommended linking line is the following:
mkl_intel_c.lib mkl_intel_thread.lib mkl_core.lib libiomp5md.lib
--Gennady



Thanks for the linking line suggestion. As for the manual, I knew where the manual is located in the MKL directory. What I was asking though, is which section in the manual, clarifying my original question.
0 Kudos
Gennady_F_Intel
Moderator
3,359 Views
chapter 5 - Linking Your Application with Intel Math Kernel Library

0 Kudos
MikeLevine
Beginner
3,359 Views
chapter 5 - Linking Your Application with Intel Math Kernel Library


Also, see the detailed directory structure in Chapter 3, which you can cross-reference with the libraries in Chapter 5 (See table 5-3).


0 Kudos
Reply