Re: location of frameworks at runtime
Re: location of frameworks at runtime
- Subject: Re: location of frameworks at runtime
- From: Chris Hanson <email@hidden>
- Date: Sat, 6 Dec 2003 19:32:29 -0600
On Dec 6, 2003, at 5:34 AM, Olof Hellman wrote:
If I put the framework inside the application bundle in the Frameworks
directory at .../myApp.app/Contents/Frameworks/ the app won't launch
-- I get a ' can't open library:
/Library/Frameworks/myApp.framework/Versions/A/myApp ' message in the
console
This is due to a Mach-O design flaw whereby a framework or other
shared/dynamic library has its intended installation path embedded
within it and any libraries that link against it. This is unlike a
more modern executable format like PEF, which only embeds a library
name or identifier, and searches a well-defined set of locations in a
well-defined sequence to find a library by name at load time.
You need to do a couple of things. If you're going to embed your
framework in your application, you need to set the framework's "install
path" to "@executable_path/../Frameworks". You should also pass the
linker an additional option, "-headerpad_max_install_names", which
tells it to pad out the field it stores this information in so the
information can be changed within the library without rebuilding it.
(There's a command-line tool that can do this.)
You also need to add a "copy files" build phase to the target using
your framework, and have it copy the framework itself into your
application's "Frameworks" folder.
If the "install path" thing seems a little archaic to you too, file a
bug in RADAR <http://bugreport.apple.com/> and let Apple know that we
shouldn't have to specify something like this on a modern system.
-- Chris
-- not opinionated at all, nope
-- not even going to mention -seg1addr...
--
Chris Hanson <email@hidden>
bDistributed.com, Inc.
Outsourcing Vendor Evaluation
Custom Mac OS X Development
Cocoa Developer Training
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.