Re: Custom framework path issues...
Re: Custom framework path issues...
- Subject: Re: Custom framework path issues...
- From: Preston Jackson <email@hidden>
- Date: Tue, 12 Aug 2008 06:57:23 -0600
Nishal,
See comments inline.
On Aug 12, 2008, at 6:28 AM, Nishal Thomas wrote:
Thanks Preston. I see what you mean, is this static linking of some
form? I was under the impression all included frameworks in a
project were setup for dynamic linking, exhisting as well as custom.
No, this isn't static linking. The dynamic linker needs to know where
to find your A.framework at run time. During the build it looks into
the A.framework and pulls out this information, called the "Dynamic
Library Install Name" in the Xcode Build Settings, and records that in
the B.app executable. When you run B.app, it tries to dynamically load
the framework from that directory.
There are several options to this Dynamic Library Install Name that
make it more flexible. Prepending it with @executable_path makes the
dynamic linker look for the framework relative to the executable, in
this case B.app/Contents/MacOS/B. You can also use @loader_path, which
would let you use the framework from a plugin or from another
framework, or @rpath, which loads the framework from relative to an
arbitrary search path in your built application.
I'm new to Mac development so forgive my ignorance. I think I messed
with the deployment location settings of the target to place the
build result in ~/Library/Frameworks/ folder. I actually wanted it
to go to /System/Library/Franeworks/ but due to permission issues I
settled for $(HOME) instead.
As a rule, developers stay out of the /System/Library/Frameworks
directory. I also consider putting frameworks into ~/Library/
Frameworks an extreme measure. It is better to encapsulate your
framework within your application bundle. In the example you posed,
they should go in B.app/Contents/Frameworks. You should copy the
A.framework into your B.app bundle in a "Copy Files" build phase in
your B.app Target.
The whole install / deploy folders concepts are confusing especially
coming for the PC world. Will probably need to read up more stuff on
this before trying to get things right the first time around. Not
sure if I'll get what you said working straight away, will come back
for help soon :).
I wrote a few blog posts about this a while back. They might help (or
they might not :) Take a look if you are reading about frameworks.
Basics:
http://sidelightblog.blogspot.com/2008/06/frameworks-are-great-part-1.html
My specific problem, using a framework that uses a framework, from a
loaded bundle:
http://sidelightblog.blogspot.com/2008/06/frameworks-are-great-part-2.html
My solution, using @rpath:
http://sidelightblog.blogspot.com/2008/07/frameworks-are-great-part-3.html
Preston
http://sidelightblog.blogspot.com
Sent from my iPhone
On 12/08/2008, at 23:54, Preston Jackson <email@hidden>
wrote:
Nishal,
You are correct to include A.framework in the B.app bundle. To do
so, you need to specify the the "Installation Directory" path of
your framework to be relative to the executable code in your
application.
Typically, the executable in an app bundle would be:
B.app/Contents/MacOS/B
And frameworks in an app bundle would be in:
B.app/Contents/Frameworks/
Change the install path to be relative to the executable, namely
the "Installation Directory" should be "@executable_path/../
Frameworks". There are other options for more complicated scenarios
including using @loader_path, or @rpath. Check out the docs here to
see which install path you should use.
http://developer.apple.com/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/CreatingFrameworks.html#/
/apple_ref/doc/uid/20002258-106880-BAJJBIEF
Also, the dyld release notes for 10.5 talk about @rpath, which is
really flexible.
http://developer.apple.com/releasenotes/DeveloperTools/RN-dyld/index.html
Preston
http://sidelightblog.blogspot.com
On Aug 11, 2008, at 7:57 PM, Nishal Thomas wrote:
I have two XCode projects say A and B with the following details:
- A is a Framework with deployment folder - $(HOME)/Library/
Frameworks/
- B is an Application which can be in any location (in my case it
is in SVN and so other developers can sync up and work on the same
code base and A is in SVN as well)
- B depends on A, so I've included A in B as a Framework (I'm not
sure if this is the right thing to do)
I tried all Path Type setups for A in B but none seem to work on
other developers machines. I want to be able to use $(HOME)/
Library/Frameworks/ as the Path for Framework A in B but seems
like XCode is not able to do that.
I even went to the extent of using vi to edit the main project
file of B and set the path as Absolute and Path = "$(HOME)/Library/
Frameworks/" and XCode reads in the settings but still shows the
Framework A in B as red.
Any ideas how I could solve this path issue? I'm able to compile
on my machine, but I don't want to have that /Users/<myhome>/
embedded in the project file and other developers having to change
it every time then causing a commit to SVN.
TIA
_______________________________________________
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
_______________________________________________
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