Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 7/13/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Use Shared Libraries on macOS

On macOS, 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, which eliminates the dependency on libraries found on DYLD_LIBRARY_PATH.

If your compilations do not use DYLD_LIBRARY_PATH 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_tool to 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 code 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 install_name_tool command to set @executable_path to 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.