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

run--time error: cannot find mkl library on OS X 10.11 el capitan

Doron_G_
Beginner
1,050 Views

Fort and Xcode give error message on OS X El Capitan on run-time error when trying to use openmp
or mkl options. I have set DYLD_LIBRARIES_PATH parameter but it does not help.
This is the error message on ifort:
dyld: Library not loaded: @rpath/libmkl_intel_lp64.dylib
Referenced from: /Users/dorongepner/Documents/./a.out
Reason: image not found

 

 

 

0 Kudos
14 Replies
Evarist_F_Intel
Employee
1,050 Views

Hi Doron,.

Looks like the problem caused by OS X 10.11 SIP. But it is really weird that setting DYLD_LIBRARY_PATH does not help.

Could you please share all the steps: linking the application, setting DYLD_LIBRARY_PATH, and running it?

Did you take a look at the section 'Dynamic Library Dependencies' here: https://software.intel.com/en-us/articles/os-x-1011-support-in-intel-parallel-studio-xe-2016

0 Kudos
Doron_G_
Beginner
1,050 Views
Here are the steps that I did. I set DYLD_LIBRARY_PATH inside Xcode (attached file: percolate4.xcodeproj). Then I run ifort -mkl try.f90 and then ./a.out and I get the message: dyld: Library not loaded: @rpath/libmkl_intel_lp64.dylib Referenced from: /Users/dorongepner/Documents/./a.out Reason: image not found Trace/BPT trap: 5 I looked in this file you mention, but it did not seem to help. Thanks, Doron
0 Kudos
Evarist_F_Intel
Employee
1,050 Views

Could you please try to link your application with rpath set to MKL library dir (replace $MKLROOT with actual MKL directory)?

$ ifort -mkl -Wl,-rpath,$MKLROOT/lib try.f90
0 Kudos
Doron_G_
Beginner
1,050 Views
I tried this. I get the same error message. Thanks, Doron
0 Kudos
Evarist_F_Intel
Employee
1,050 Views

Oh it might happen because the application could not locate Intel OMP library (for the same reason: OS X SIP).

Could you please also add -Wl,-rpath,$ICLROOT/lib into the link line (libiomp5.dylib should be in $ICLROOT/lib)?

BTW, what MKL and ICL version do you use? Not sure about ICL, but MKL starts support OS X 10.11 since 11.3.1+ (almost the latest available version of MKL)...

0 Kudos
Doron_G_
Beginner
1,050 Views

Hi I tried this and ifort actually works in command line. I cannot still run it on Xcode.

0 Kudos
Evarist_F_Intel
Employee
1,050 Views

Sorry for delay.

Once you create an executable via XCode (which doesn't work), could you please run the following and dump the result here?

$ otool -L a.out
$ otool -l a.out | grep -A3 RPATH

This will help us to understand whether the problem is in the libraries or in the executable.

What MKL version and ICL do you use?

0 Kudos
Doron_G_
Beginner
1,050 Views
Hi Evarist, Attached the two files you requested--output of your commands. I actually have another question. I tried to use in the project file the commands OMP_NUM_THREADS 4; OMP_STACKSIZE 200M. However, they also do not work. Is there a way to do this in ifort command line? Thanks, Doron
0 Kudos
Doron_G_
Beginner
1,050 Views
Hi, I upgraded my mac to OS X 10.11.3 and now Xcode does not work entirely with intel fortran. It sais upon running: "cannot launch try.f90" or any other file I try to run. It might be that he cannot write the executable from security reasons. I wonder if there is an easy fix. Thanks, Doron
0 Kudos
Rasmus_F_
Beginner
1,050 Views

Any updates on this? I'm struggling with the same problem. 

$ otool -l a.out | grep -A3 rpath
         name @rpath/libmkl_intel_lp64.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 0.0.0
compatibility version 0.0.0
--
         name @rpath/libmkl_intel_thread.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 0.0.0
compatibility version 0.0.0
--
         name @rpath/libmkl_core.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 0.0.0
compatibility version 0.0.0
--
         name @rpath/libiomp5.dylib (offset 24)
   time stamp 2 Wed Dec 31 16:00:02 1969
      current version 5.0.0
compatibility version 5.0.0
$ otool -l a.out | grep -A3 RPATH
$

 

0 Kudos
Ngoc_Thanh_Nam_N_
1,050 Views

I have this problem too. Can't find solution anywhere.

0 Kudos
Ying_H_Intel
Employee
1,050 Views

Hi Doron G and all, 

I recalled, there is some discussions about the specific to OS X* 10.11 (Please see here).

You may try some workaround on that article. https://software.intel.com/en-us/articles/os-x-1011-support-in-intel-parallel-studio-xe-2016

For link MKL dylib library, another workaround: is it for ok you link static mkl library  

for example, ifort -mkl  -static-intel ? 

Best Regards,

Ying 

 

Dynamic Library Dependencies

Starting with OS X 10.11 DYLD_LIBRARY_PATH environment variable might be reset under OS X new   security policy, System Integrity Protection. As a result an application built with Intel® Parallel Studio version 2016 (Update 1) or earlier might not work since it is unable to locate dependent libraries such as libiomp5.dylib.

Workaround

The following is suggested workaround: make all dynamic libraries run-path depended by following this two step process.

     1.  Add directories in which dependencies (required libraries) are located to the application rpath  during the application linking:

1 $ icc x.o -Wl,-rpath,$ICLROOT/lib -L$ICLROOT/lib -liomp5 -o app.out

     2.   Change the dependency from non-run-path-dependent library to run-path-dependent library:

1 $ install_name_tool -change libiomp5.dylib @rpath/libiomp5.dylib app.out

     3.   Repeat Step 2  for all dependencies from composer

0 Kudos
Evarist_F_Intel
Employee
1,050 Views

Hi Rasmus,

you mentioned that:

$ otool -l a.out | grep -A3 RPATH
$

That is definitely bad. Ideally there should be at least two matches: one for MKL library path and another one for libiomp5.dylib library path. Do you add -Wl,-rpath,$MKLROOT/lib -Wl,-rpath,$MKLROOT/../compiler/lib during the linkage of the executable, as Ying suggested?

0 Kudos
Rasmus_F_
Beginner
1,050 Views

My problem was solved some other way. Turns out it only happened when I ran my mkl-linked executable from a bash-script with #!/bin/bash shebang. Theres a description here: https://forums.developer.apple.com/thread/9233 .. basically 

 If a script file begins with "#!/bin/bash", or any other #!/path/to/interpreter, the DYLD environment variables are omitted from the set of environment variables passed to that interpreter. This applies even if the current and new interpreters are instances of the same interpreter.

This means that the DYLD_LIBRARY_PATH was not exported to the bash script. Sorry for the confusion. This seems like an incompatibility with how Intel/MKL is set up and the security in Mac OS 10.11, no?

0 Kudos
Reply