• 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: Locating a Framework in a Non-Standard Directory
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Locating a Framework in a Non-Standard Directory


  • Subject: Re: Locating a Framework in a Non-Standard Directory
  • From: Sherm Pendley <email@hidden>
  • Date: Wed, 14 Mar 2007 14:18:35 -0400

On Mar 14, 2007, at 9:43 AM, Gustavo Vera wrote:

Again, I don't think the problem is related to a missing copy build phase.

What I want is to install a Framework (developed by third parties) on a
different place.
Not in the standard locations at /System/Library/Frameworks or at
/Library/Frameworks.


In this particular case, What I want is to install this Framework in
/Library/Frameworks/MyProduct/.

The frameworks path you set up on Xcode is only used at compile time. At compile time, the framework's install name is copied into the app binary. At run time, the loader reads the copied install name from the app binary, and uses that to locate the library binary.


Use install_name_tool to change the install name of the framework. You'll need to re-link your app after you do that, so the framework's new install name is copied into your app binary. For many frameworks the new install name cannot be longer than the old one. (Defining a larger buffer size for the install name is a framework build option, but it's not done by default. By default, the buffer is exactly the number of bytes needed for the install name as defined when the library was built.)

Install_name_tool can also change the copy of an install name in an application binary, but that's less useful - since that's copied from the framework by the linker, you'd have to add a script build step to your build to re-run it every time you build your app.

Another option would be to change the beginning of the framework's install name to @executable_path/../Frameworks/etc. The first component expands to the application binary itself, not the .app directory, so at run time the loader will look for YourApp.app/ Contents/Frameworks/etc. With this option, it's common to add a "Copy Files" build step to your target, set it to copy to "Frameworks/", and add the framework(s) you want to copy to that build step by dragging them from Xcode's "Frameworks/" file group.

If your framework is part of an application suite, you can share it among all the suite's apps. If there is a "master" app in the suite, you could bundle the framework with that, and set its install name to "@executable_path/../../../Master.app/Contents/Frameworks/". Or you could keep your suite's frameworks in a folder of their own, and use install names beginning with "@executable_path/../../../Frameworks/".

Is there a chance that, with some frameworks, you can only use it correctly
if they are installed on the standard locations??.

It's possible, but not likely to be the case in my opinion. Frameworks are designed to be easily relocatable by nature, although if the authors wanted to "anchor" it to a specific location they certainly could.


sherm--

Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Locating a Framework in a Non-Standard Directory
      • From: "Gustavo Vera" <email@hidden>
References: 
 >Locating a Framework in a Non-Standard Directory (From: "Gustavo Vera" <email@hidden>)
 >Re: Locating a Framework in a Non-Standard Directory (From: Carl Johan Foss <email@hidden>)
 >Re: Locating a Framework in a Non-Standard Directory (From: "Gustavo Vera" <email@hidden>)

  • Prev by Date: Survey: API reference "metadata"
  • Next by Date: Problem redrawing views while window resize button is held
  • Previous by thread: Re: Locating a Framework in a Non-Standard Directory
  • Next by thread: Re: Locating a Framework in a Non-Standard Directory
  • Index(es):
    • Date
    • Thread