Community
cancel
Showing results for 
Search instead for 
Did you mean: 
xiang_c_
Beginner
265 Views

Runtime error when building with mkl dylib

When I built my program with MKL statically (.a files), everything was fine. But, when I built the code with those .dylib files and ran it, I got following errors:

dyld: Symbol not found: _MKL_Detect_Cpu_Global_Lock
  Referenced from: /opt/intel/compilers_and_libraries_2017.4.181/mac/mkl/lib/libmkl_intel_lp64.dylib
  Expected in: flat namespace
 in /opt/intel/compilers_and_libraries_2017.4.181/mac/mkl/lib/libmkl_intel_lp64.dylib
Abort trap: 6

What does this usually imply? I tried to add the directory containing .dylib files into $PATH, but it didn't help.

 

0 Kudos
4 Replies
Zhen_Z_Intel
Employee
265 Views

Hi xiang,

' _MKL_Detect_Cpu_Global_Lock' is bss symbol defined in libmkl_avx*.dylib, libmkl_core.dylib, libmkl_mc.dylib, libmkl_mc3.dylib, libmkl_p4m.dylib & libmkl_p4m3.dylib

If you meet linage error with missing symbol that probably because the lib path of MKL is not being linked, please use '-L${MKLROOT}/lib' for your link line. You could also check with MKL advisor to generate your link line.

Bets regards,
Fiona

xiang_c_
Beginner
265 Views

Hi Fiona,

I'm sure I've added that path. Actually, the building process itself succeeded and the executable file was generated. These errors popped up when I ran the file.

Best,

Xiang

Ying_H_Intel
Employee
265 Views

Hi Xiang,

Have you run the mklvars.sh? 

Generally, run one code with mkl dynamic library, please check:

 add the path of lib<product>.dylib in system environment before run binary (The <product> could be "mkl" or "ipp"). There are two methods to realize the solution:

  • Run shell script file to set environment variables, for example, setting MKL:
    > /opt/intel/compilers_and_libraries_2017.*.***/mac/mkl/bin/mklvars.sh <ia32|intel64>
  • Or write command to set directly, for example, setting MKL:
    export DYLD_LIBRARY_PATH="/opt/intel/compilers_and_libraries_2017.*.***/mac/mkl/lib:$DYLD_LIBRARY_PATH

and let us know if it works.

Best Regards,

Ying

https://software.intel.com/en-us/articles/dyld-library-not-loadedlibiomp5dylib?page=1

xiang_c_
Beginner
265 Views

Hi Ying,

Thanks for your detailed instructions, it helped me to locate the problem. It is somehow due to my use of "find_library" command in cmake (weird). When I wrote out the full path of those libraries, the problem has gone. 

Thank you again!

Best,

Xiang

Reply