I have a collection of projects that I'm compiling as dynamic libraries. Each of these .dylibs depend on other various .dylibs that I would like to place in various other directories (i.e. some at the executable path, some at the loader path, some at a fixed path).
When I run otool -L
on the compiled libraries, I get a list of paths to those dependencies but I have know idea how those paths are being set/determined. They almost appear pseudo random. I've spent hours messing with the "Build Settings" in Xcode to try and change these paths (w/ @rpath, @executable_path, @loader_path, etc.) but I can't seem to change anything (as checked by running otool -L
). I'm not even entirely sure where to add these flags and don't really understand the difference between the following or how to properly use them:
Linking - "Dynamic Library Install Name"
Linking - "Runpath Search Paths"
Linking - "Other Linking Flags"
Search Paths - "Library Search Paths"
When I run install_name_tool -change
on the various libraries, I am able to successfully change the run path search paths (again as verified by running otool -L
to confirm).
I'm running Xcode 4.2 and I'm very close to giving up and just using a post-build script that runs install_tool_name to make the changes. But its a kludge hack fix and I'd prefer not to do it.
Where can I see how the search/run paths for the dylib dependencies are being set?
Anyone have any ideas on what I might be doing wrong?
otool -L
lists all the install names. The first 'install name' listed is that of the the library itself. Any additional paths listed are for its dependencies. Assuming you've compiled the dependencies from source, setting the "Dynamic Library Install Name" in Xcode will properly set these paths. However in my case, the dependencies are from 3rd parties so the paths were already set. Since I have no control over the compilation of the 3rd party libraries I'm forced to useinstall_name_tool -change
. – Effulgence