Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

(KHC) Shadow

macrumors newbie
Original poster
May 20, 2008
9
0
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:

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:
You can change the thread title by clicking on the edit button, then clicking on "Go Advanced". On the advanced editing page, you'll have an option to change the tread title.
 
For some reason I got the same firewall error as before when I tried that.

Code:
Sucuri WebSite Firewall - CloudProxy - Access Denied
What is going on?
You are not allowed to access the requested page. If you are the site owner, please open a ticket in our support page if you think it was caused by an error: https://support.sucuri.net. If you are not the owner of the web site, you can contact us at soc@sucuri.net. Also make sure to include the block details (displayed below), so we can better troubleshoot the error.
 
That is the web firewall employed by MacRumors. The coding in your post is triggering it. Unfortunatly, there is no easy way around that.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.