I\'m creating a Photoshop Plug In on OS X (Basically a Bundle / DyLib).
I\'m using Intel Compiler and uses OpenMP by linking against OpenMP (libiomp5
).
Your solution is correct for modern libraries that are aware of @rpath. OpenMP library supports @rpath starting compiler version 16.0 update 2. In your case your RPATH settings are ignored by system
Can you try to link with the with openmp library from photoshop? as I understand they did a workaround for this and updated install_name from libiomp5.dylib to "@executable_path/../Frameworks/libiomp5.dylib". so if you link to that library the openmp name in "otool -l" output will be changed to @executable_path/../Frameworks/libiomp5.dylib
some hints
If photoshop updates install name via install_name_tool
$ otool -l ./a.out | grep omp
name libiomp5.dylib (offset 24)
# libiomp5.dylib was copied to the location with test
$ install_name_tool -id "@executable_path/../Frameworks/libiomp5.dylib" libiomp5.dylib
$ LIBRARY_PATH=.:$LIBRARY_PATH icc -openmp test1.cpp
$ otool -l ./a.out | grep omp
name @executable_path/../Frameworks/libiomp5.dylib (offset 24)
RPATH usage
install_name_tool -id "@executable_path/../Frameworks/libiomp5.dylib" libiomp5.dylib
$ LIBRARY_PATH=.:$LIBRARY_PATH icc -openmp test1.cpp -Wl,-rpath,.
$ ./a.out
dyld: Library not loaded: @executable_path/../Frameworks/libiomp5.dylib
Referenced from: /nfs/inn/home/vpolin/mac/./a.out
Reason: image not found
Trace/BPT trap: 5
$ install_name_tool -id "@rpath/libiomp5.dylib" libiomp5.dylib
$ LIBRARY_PATH=.:$LIBRARY_PATH icc -openmp test1.cpp -Wl,-rpath,.
$ otool -l ./a.out | grep omp
name @rpath/libiomp5.dylib (offset 24)
$ ./a.out
4 8 8 8 8
--Vladimir