tags:

views:

6

answers:

1

Hello,

I've looked at a few related questions and cannot seem to find a solution for myself.

Basically I'm using the libmp3lame.dylib in my Xcode project. The install process for lame produced the .dylib and placed it in usr/local/lib and to get Xcode to build and run the project I changed the Library Search Paths to include the above folder. This works fine.

Now it's come to producing a release version and I want to include the .dylib in the bundle so that the user doesn't have to put up with an install phase or anything similar. I created a copy files phase of the target and this dumps the .dylib into the Frameworks folder in the contents of the bundle. However, running otool on the binary shows that instead of using the .dylib inside the bundle, the compiler has linked it to the usr/local/lib version (even if I delete that version).

Looking at the other results in the otool output I have other frameworks being linked to inside the bundle, just not the .dylib. Looking at the properties for both these frameworks and the .dylib in Xcode I can't see any differences other than file type.

My searching suggests I need to use rpath or similar, but I've no clue where to apply this in Xcode.

A: 

My tip is to look at the build output, how does it actually run ld?

lericson
I'm guessing the relevant part of ld is: "-lmp3lame.0.0.0". Does the -l deal with the lib part of the filename itself? Otherwise I'm confused because the filename is libmp3lame.0.0.0.dylib.
Septih
Ah, it does. I'm thinking the problem is that it's looking for a libmp3lame.dylib in the directories defined earlier in the build (the Library Search Paths), but the copy files phase doesn't put the dylib in the bundle til after the ld. So new dilemma is how to explicitly tell it to look for the library there rather than just looking for one in a few folders. Still confused as to why it linked to the usr/local/lib folder one when I deleted the .dylib there though...
Septih