Showing results for 
Search instead for 
Did you mean: 

Statically linking to MKL 2017.3 on GCC 5.4.0

Hi there, I am trying to statically link my library to MKL 2017.3 (using Intel OpenMP for threading), under GCC 5.4.0, on Ubuntu. So according to the link line advisor, I need to link with libmkl_core, libmkl_intel_thread, libmkl_intel_lp64, and libiomp5. I'm finding that when I try to link with libiomp5.a, (and all the others *.a) I get the following linker error:

/usr/bin/ld: version node not found for symbol omp_set_nest_lock@OMP_3.0
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status

[I replaced my library name with XXX]

When I change the configuration to link with (and the rest still *.a) my program builds successfully (I have not yet tried to run it, for unrelated reasons). Can anyone explain to me what the above error means? I assumed it was due to the symbol omp_set_nest_lock@OMP_3.0 not being defined, but I checked libiomp5.a with the 'nm' command-line tool and the symbol does appear to be defined there. I'm reasonably confident that the linker is finding all the libraries.

In general, is it valid to link statically with libiomp5? I would have assumed so, since libiomp5.a is provided. I have also successfully linked my library to MKL statically on Windows and Mac, so I assumed it would be possible on Linux also.

Any help would be much appreciated. Let me know if you need more information. I've done very little development for non-Windows platforms, so hopefully I haven't omitted anything important.


0 Kudos
1 Reply

Hi Andrew,

thank you for your report.  As i recalled, the issue in openmp should be resolved in latest version.

I  try 2018 beta  with latest   gcc version 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)

yhu5@kbl01-ub:~/eigen$ g++ -I./eigen3 GEMM.cpp -L/opt/intel/compilers_and_libraries_2018.0.098/linux/mkl/lib/intel64  -Wl,--start-group /opt/intel/compilers_and_libraries_2018.0.098/linux/mkl/lib/intel64/libmkl_intel_lp64.a /opt/intel/compilers_and_libraries_2018.0.098/linux/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/compilers_and_libraries_2018.0.098/linux/mkl/lib/intel64/libmkl_core.a -Wl,--end-group /opt/intel/compilers_and_libraries_2018.0.098/linux/compiler/lib/intel64/libiomp5.a -shared -o gemm -std=c++11 -fPIC -lpthread -ldl

Seem it works fine.

Best Regards,


If with 2017 update 3, where MKL version is 2017 update 2.  get similar error

yhu5@kbl01-ub:~/eigen$ g++ -I./eigen3 GEMM.cpp -Wl,--start-group /opt/intel/compilers_and_libraries_2017.3.191/linux/mkl/lib/intel64/libmkl_intel_lp64.a /opt/intel/compilers_and_libraries_2017.3.191/linux/mkl/lib/intel64/libmkl_intel_thread.a /opt/intel/compilers_and_libraries_2017.3.191/linux/mkl/lib/intel64/libmkl_core.a -Wl,--end-group /opt/intel/compilers_and_libraries_2017.3.191/linux/compiler/lib/intel64/libiomp5.a -shared -fPIC -o gemm -lpthread -ldl                   /usr/bin/ld: gemm: version node not found for symbol omp_get_wtime@OMP_2.0
/usr/bin/ld: failed to set dynamic section sizes: Bad value
collect2: error: ld returned 1 exit status