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

Cactus Dan

macrumors member
Original poster
Aug 8, 2010
30
0
Howdy,

My question is about linking to .dylib files from the directory:
Developer/SDKs/MacOSX10.x.sdk/usr/lib/xxxxx.dylib

... will the compiled application automatically search the hidden directory:
usr/lib/xxxxx.dylib

...on machines that don't have the developer tools installed?

Adios,
Cactus Dan
 

chown33

Moderator
Staff member
Aug 9, 2009
10,750
8,422
A sea of green
Read this article:
http://cocoadev.com/wiki/ApplicationLinking

Pay attention to the concept of install name. Also the significance of @rpath when used in a dylib install name. There are other @names, too. It won't make sense until you know what an install name is.

Then read the man page for dyld (man dyld).


BTW, you're posting relative pathnames instead of absolute. This is relative:
Code:
usr/lib/xxxxx.dylib
this is absolute:
Code:
/usr/lib/xxxxx.dylib
The absolute path is absolute, regardless of the working directory. The relative path is relative to current working directory, which may be changed.

http://en.wikipedia.org/wiki/Relative_path
http://en.wikipedia.org/wiki/Working_directory
 

Cactus Dan

macrumors member
Original poster
Aug 8, 2010
30
0
Howdy,
AHA! Thanks for that link.
So, the actual install path of the .dylib file in question IS in the hidden folder, according to the terminal output:
Code:
otool -D /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libiconv.2.dylib 
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libiconv.2.dylib:
/usr/lib/libiconv.2.dylib
I suspect as much but just wasn't absolutely sure. That terminal command will be added to my list of useful commands.


...BTW, you're posting relative pathnames instead of absolute. This is relative:
Code:
usr/lib/xxxxx.dylib
this is absolute:
Code:
/usr/lib/xxxxx.dylib
The absolute path is absolute, regardless of the working directory. The relative path is relative to current working directory, which may be changed...
Hehe, yeah that's why I never trust my typing and always drag and drop when I need the correct path. ;)

Thanks again.

Adios,
Cactus Dan
 

Cactus Dan

macrumors member
Original poster
Aug 8, 2010
30
0
Howdy,
You should also be aware that the '/Developer' folder no longer exists on the latest versions of Xcode.
Well, when you unhide the hidden files and directories, do you have the directory:
/usr/lib/
... showing in the root directory of your HD?

Adios,
Cactus Dan
 

Cactus Dan

macrumors member
Original poster
Aug 8, 2010
30
0
Howdy,
Yes.

But Apple considers it theirs and it's contents have changed in past versions of the OS.
OK, cool. I'm not worried about that because I'm not setting the "Library Search Paths", "Header Search Paths" and "Other Linker Flags" options to that hidden directory. I'll be setting those options to the:
/Developer/SDKs/MacOSX10.x.sdk/usr/lib/libiconv.dylib
...directory, since we've established that the install path of the above directory IS the hidden folder.

Normally I wouldn't even be concerned with linking to an individual library in one of the Mac OS SDKs, except in this situation I'm creating an FBX import/export plugin for an existing application, which seems to have a problem with their c++ plugin API, where the FBX SDK library can't find the libiconv.dylib. So I have to force the directory search by including the paths in the "Library Search Paths", "Header Search Paths" and "Other Linker Flags".

If I use the FBX SDK library in a stand alone application, it has no problem finding the libiconv.dylib library.

Adios,
Cactus Dan
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.