• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Linking to DYLIBs in bundles and install_name_tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Linking to DYLIBs in bundles and install_name_tool


  • Subject: Re: Linking to DYLIBs in bundles and install_name_tool
  • From: Steve Christensen <email@hidden>
  • Date: Mon, 23 Jun 2008 11:31:55 -0700

From my reading of the man page, it looks like the -change option changes the name of a dylib or framework some code links against, but in the code not the dylib itself; and the -id option is used for changing the name of a dylib or framework before some other code tries to link against it.

As for an Xcode solution, you could create a target that builds the dylib (if you're actually building it), and add a script phase to run install_name_tool:

install_name_tool -change -id @executable_path/../Frameworks/ mylib.dylib .../path/to/mylib.dylib

Make sure your app target is dependent upon this new target so install_name_tool is always run before your app target is built. Then add the fixed dylib to your target's dylibs/frameworks to link against, create a copy files build phase that copies to your bundle's Frameworks folder and drag the dylib into that phase's list of files to copy.

To make sure everything's built as expected, you can type the following in a Terminal window:

  otool -L .../path/to/myapp.app/Contents/MacOS/myapp

That will list the full paths to all of the dylibs/frameworks your app links against.


On Jun 23, 2008, at 10:34 AM, Josh de Lioncourt wrote:

I just can't get my head wrapped around this. Every time I think I've got it, it turns out I'm wrong and it doesn't work. And yes, I've read tons of docs, tutorials, and man pages for the various parts in question, and I just don't understand.

I have a dylib that i want to include as part of my application bundle, which my app links to.

I use a Copy Files faze to copy the dylib into the appropriate location inside the application bundle at build time.

I have a script which runs during the build process which uses install_name_tool's -change operation to change the reference of / usr/local/lib/mylib.dylib to the path of the dylib in the application bundle. I have read the man pages for install_name_tool, and a lot of other stuff as well, I there seems to be some contradictory info out there of whether I should be using -change or -id, and I do not understand, precisely, the difference between the two, and/or if -id even applies to what I'm trying to accomplish.

A step-by-step on how to do this, and an explanation for future reference of the difference between -change and -id, (something beyond the syntax differences), would really help. I think I've been coding in Windows for just too long, and am finding a lot of this stuff bewildering.

Attachment: PGP.sig
Description: PGP signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Linking to DYLIBs in bundles and install_name_tool (From: Josh de Lioncourt <email@hidden>)

  • Prev by Date: Re: Smart group for "hot" files?
  • Next by Date: Re: Remote SVN issue with Xcode 3.0
  • Previous by thread: Linking to DYLIBs in bundles and install_name_tool
  • Next by thread: Remote SVN issue with Xcode 3.0
  • Index(es):
    • Date
    • Thread