Application Configuration for Dynamic Libraries

When running your application that uses dynamic libraries it is necessary for the application to know where the dynamic libaries are located. Dynamic libraries can be configured via two methods.

During application development you can use the DYLD_LIBRARY_PATH environment variable to set the path where the Intel compiler dynamic libaries are located. This environment variable is set to the appropriate directory when your source the or script files.

Once application development is complete, you may not want to require your customers to set an environment variable before running your application. You can embed the location of dynamic libraries in your application by using a tool provide by Apple called install_name_tool. Documentation is available on the Apple Developer Connection web site about this tool.  More information on dynamic shared libraries is also available on the Apple Developer Connection web site.

Here's an example usage:

install_name_tool -change libimf.dylib @executable_path/../Frameworks/libimf.dylib MyApp

will change all references in "MyApp" to go to "@executable_path/../Frameworks/" instead of <nopath>.

At runtime, the magic string "@executable_path" is expanded to the current path ( /<.....>, so the user can drag the whole app directory anywhere they want without having to worry about where the dependent dylibs are.

You will need to run the install_name_tool on both your application and the Intel libraries used by your application.

For example:

otool -L libifcore.dylib
     libifcore.dylib (compatibility version 0.0.0, current version 1.0.0)
     libimf.dylib (compatibility version 0.0.0, current version 0.0.0)
     libirc.dylib (compatibility version 0.0.0, current version 0.0.0)
     /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.1.2)

So you have to do

install_name_tool -change libifcore.dylib @executable_path/../Frameworks/libifcore.dylib libifcore.dylib

and so on for all the cross-references in the three Intel libraries.
For more complete information about compiler optimizations, see our Optimization Notice.