Using Shared Libraries on macOS*
This topic only applies to
, it is possible to store path information in shared libraries to perform library searches. The compiler installation changes the path to the installation directory, but you will need to modify these paths if you move the libraries elsewhere. For example, you may want to bundle redistributable Intel® libraries with your application. This eliminates the dependency on libraries found on
If your compilations do not use
to find libraries, and you distribute executables that depend on shared libraries, then you will need to modify the Intel shared libraries (
../lib/*.dylib) using the
install_name_toolto set the correct path to the shared libraries. This also permits the end-user to launch the application by double-clicking on the executable. The command below will modify each library with the correct absolute path information:
for i in *.dylib do echo -change $i `pwd`/$i done > changes for i in *.dylib do install_name_tool `cat changes` $i done
You can also use the
@executable_pathto change path information for the libraries bundled in your application by changing the path appropriately.
Be sure to recompile your sources after modifying the libraries.