Sorry about the title––I was having issues with some sort of firewall blocking me and there is no way I can find to change it...Title now fixed. Thanks admin.
I am having some issues with linking to dylibs. I have done quite a bit of reading on rpaths and linking, but I'm still running into errors. Here is the setup:
the Xcode project contains a group of dylibs, many of which rely on each other. The relevant xcode build phases are Copy Files (which copies all dylibs into the app Frameworks directory), Compile Sources, Link Binary with Libraries, and Run Script.
The script attempts to fix the rpath/link settings. After all files are copied and the executable is compiled and linked, the app directory looks like this:
So far I have tried a few things. First I made all of the references in the executable to the dylibs
In other words, running
returns
The dylibs in the frameworks directory were configured with the same path.
I also tried a different approach using rpaths such that the previous command would return
and the rpath was set to
Again, the dylibs were configured the same way.
In both situations, I get errors such as
What am I doing wrong? Any ideas would be appreciated. Thanks!
I am having some issues with linking to dylibs. I have done quite a bit of reading on rpaths and linking, but I'm still running into errors. Here is the setup:
the Xcode project contains a group of dylibs, many of which rely on each other. The relevant xcode build phases are Copy Files (which copies all dylibs into the app Frameworks directory), Compile Sources, Link Binary with Libraries, and Run Script.
The script attempts to fix the rpath/link settings. After all files are copied and the executable is compiled and linked, the app directory looks like this:
Code:
example.app/Contents/Frameworks/<a bunch of dylibs>
example.app/Contents/MacOS/<executable>
example.app/Contents/<resources, the other typical stuff, etc...>
So far I have tried a few things. First I made all of the references in the executable to the dylibs
Code:
@executable_path/../Frameworks/<somelib>.dylib
In other words, running
Code:
otool -L <executable>
returns
Code:
@executable_path/../Frameworks/<lib1>.dylib
@executable_path/../Frameworks/<lib2>.dylib
@executable_path/../Frameworks/<lib3>.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
/usr/lib/libobjc.A.dylib
The dylibs in the frameworks directory were configured with the same path.
I also tried a different approach using rpaths such that the previous command would return
Code:
@rpath/Frameworks/<lib1>.dylib
@rpath/Frameworks/<lib2>.dylib
@rpath/Frameworks/<lib3>.dylib
/System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL
/System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
/usr/lib/libobjc.A.dylib
and the rpath was set to
Code:
@loader_path/..
Again, the dylibs were configured the same way.
In both situations, I get errors such as
Code:
dyld: Library not loaded: path/<somelib>.dylib
What am I doing wrong? Any ideas would be appreciated. Thanks!
Last edited: