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

MKL with XCode: image not found

Anwar_Ludin
Beginner
554 Views

Hello,

Using XCode and following the MKL user s guide, I ve dynamically linked the MKL libraries to my application (called SmartOptions). When trying to debug the application, I got the following error (debug console):

Loading program into debugger... Program loaded. run

[Switching to process 21256]

Running

dyld: Library not loaded: libmkl_intel_ilp64.dylibReferenced from: /Users/aludin/Documents/SmartOptions/build/Debug/SmartOptions.app/Contents/MacOS/SmartOptionsReason: image not found

Using the otool, i got the following output: otool -L SmartOptions:
SmartOptions:
libmkl_intel_ilp64.dylib (compatibility version 0.0.0, current version 0.0.0)
libmkl_sequential.dylib (compatibility version 0.0.0, current version 0.0.0)
libmkl_core.dylib (compatibility version 0.0.0, current version 0.0.0)
otool -L SmartOptionsSmartOptions: libmkl_intel_ilp64.dylib (compatibility version 0.0.0, current version 0.0.0) libmkl_sequential.dylib (compatibility version 0.0.0, current version 0.0.0) libmkl_core.dylib (compatibility version 0.0.0, current version 0.0.0)

By setting theDYLD_LIBRARY_PATH environment variable (Group & Files-> Executables->SmartOptions->dbl click->arguments Tab) to/opt/intel/Compiler/11.1/080/Frameworks/mkl/lib/em64t, then the application launches correctly.

0 Kudos
6 Replies
Gennady_F_Intel
Moderator
554 Views

anwar,

yes, before running any application you have to setting up all environment variables which are related MKL. the easiest way to do that - to launch mklvarsem64t.sh scripts from \tools\environment directory.

--Gennady

0 Kudos
Ying_H_Intel
Employee
554 Views

Hello,

It is rightwhen use dynamic linkinglibrary, please make sure the DYLD_LIBRARY_PATH is defined so that exactly the dynamic librariesare found and used at run time.

We mentioned that inuserguide or KB in sporadic places.

for example, http://software.intel.com/en-us/articles/dyld-library-not-loadedlibiomp5dylib/

I will ask our doc team to hightligh it inKB or user guide.

Thank you a lotfor the sharing.

Best Regards,

Ying

0 Kudos
Artem_V_Intel
Employee
554 Views

Hello,

It is correct that you should set DYLD_LIBRARY_PATH environment variable to full path to directory that contains dynamic libraries.

Could you please specify your question more precisely? It is unclear from description above.

Thanks,

Art

0 Kudos
Anwar_Ludin
Beginner
554 Views

Art,

Pleased forgive me for the delayed response. Actually I was nt asking a question, just noticed the behavior as described in my previous post. In the meantime I checked a few things and here s my comments:

1) You can t simply call the script for setting the environment variables:

First I tried something like opening a Terminal window and then calling the script:

/opt/intel/Compiler/11.1/080/Frameworks/mkl/tools/environment/mklvarsem64t.sh

However the environment variables would still be undefined (echo $MKLROOT or echo $DYLD_LIBRARY_PATH would yield to empty strings). Then I realized that you actually have to source the script using something like:

source/opt/intel/Compiler/11.1/080/Frameworks/mkl/tools/environment/mklvarsem64t.sh

This time the environment variables would be correctly set.

2) In order to avoid the source command each time I opened a terminal window, I created a .bash_profile in my home directory and added the source command in the file:

#! /bin/sh
# .bash_profile
source /opt/intel/Compiler/11.1/080/Frameworks/mkl/tools/environment/mklvarsem64t.sh

Tested it and works fine.

3) However, even if I source the script before launching XCode, the debugger will still complain with an "image not found" message. You really have to set DYLD_LIBRARY_PATH inside XCode as mentioned in my previous post in order for gdb to find the libraries.

0 Kudos
Artem_V_Intel
Employee
554 Views

Hello Anwar,

Iagree completelywith your previous post and would like to add some small comment.

In case of multithreaded version of MKL you should also add path to the compiler 'lib' directory in DYLD_LIBRARY_PATH like this:

DYLD_LIBRARY_PATH=/opt/intel/Compiler/11.1/080/Frameworks/mkl/lib/em64t:/opt/intel/Compiler/11.1/080/lib

It is needed because 'lib' directory of the compiler contains libiomp5.dylib library.

Thanks,

Art

0 Kudos
Ying_H_Intel
Employee
554 Views

Thankseveryone's comments.

The notes should be added in user guide of the latest MKL release, MKL 10.2.6 or corresponding compiler version:
http://software.intel.com/en-us/articles/which-version-of-ipp--mkl--tbb-is-installed-with-intel-compiler-professional-edition/

Thanks
Ying

0 Kudos
Reply