Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

dyld: Library not loaded: @rpath/libimp5.dylib

Muhong_Z_
Beginner
6,041 Views

My student license of Intel Composer XE C++ 16 expired yesterday, so I downloaded the lastest Intel Composer XE C++ 17, only to find out it is compatible with OSX 11.0/12.0. So I upgraded my OSX from Yosemite to Sierra. However, I found my code generate run time error as shown in the title. I have consulted some old posts and realized I need to reset DYLD_LIBRARY_PATH to the current lib path, but it didn't help. Here are some output for your reference:

$ echo $DYLD_LIBRARY_PATH 
/opt/intel/compilers_and_libraries_2017.0.102/mac/compiler/lib:

$ otool -L main
main:
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1226.10.1)
	/usr/lib/libc++.1.dylib (compatibility version 1.0.0, current version 120.1.0)
	@rpath/libiomp5.dylib (compatibility version 5.0.0, current version 5.0.0)

 

 

 

0 Kudos
1 Solution
David_K_5
Novice
6,041 Views

Hi Muhong,

Yes, there is a problem on the Mac with @rpath.  Here is a work-around:

After successfully building your app, on a command line you must use the install_name_tool to relocate libiomp5.dylib in the executable:

install_name_tool -change @rpath/libiomp5.dylib @executable_path/`basename libiomp5.dylib` <full pathname to your executable>

where  the full pathname will be something like the following:

/Users/YourUserName/Developer/YourApp/YourApp.app/Contents/MacOS/YourExecutableAppName

To INTEL SUPPORT:

Please fix this.  It is relatively easy to work-around, but is very annoying and adds furthers steps to al of our build processes. 

Thank you.

 

 

 

View solution in original post

0 Kudos
4 Replies
David_K_5
Novice
6,042 Views

Hi Muhong,

Yes, there is a problem on the Mac with @rpath.  Here is a work-around:

After successfully building your app, on a command line you must use the install_name_tool to relocate libiomp5.dylib in the executable:

install_name_tool -change @rpath/libiomp5.dylib @executable_path/`basename libiomp5.dylib` <full pathname to your executable>

where  the full pathname will be something like the following:

/Users/YourUserName/Developer/YourApp/YourApp.app/Contents/MacOS/YourExecutableAppName

To INTEL SUPPORT:

Please fix this.  It is relatively easy to work-around, but is very annoying and adds furthers steps to al of our build processes. 

Thank you.

 

 

 

0 Kudos
Muhong_Z_
Beginner
6,041 Views

Hi David,

 

Thank you very much. I have modified the shared library install name as follows and now it works!

install_name_tool -change @rpath/libiomp5.dylib /opt/intel/compilers_and_libraries_2017.0.102/mac/compiler/lib/libiomp5.dylib main

 

 

 

0 Kudos
Vladimir_P_1234567890
6,041 Views

this is not rather problem of OSX, this is a new security feature (https://en.wikipedia.org/wiki/System_Integrity_Protection) of the OS. But changing the path via install_name_tool you are breaking library signature and breaking its security. it would be better if you can fix -rpath in your application for example by adding -Wl,-rpath,@executable_path or -Wl,-rpath,-rpath,@executable_path/../Frameworks options to your build command line.

--Vladimir

0 Kudos
fischer__christian
6,041 Views

I had the same problem with a new High Sierra Installation and both, an older 2013 composer suit and a new 2018 installation. While the command line tool works fine for me, I would like to make Vladimir suggestion work - but don't know how. What exactly do I have to add to my Make-File ? 

Thank you!

 

0 Kudos
Reply