Re: Framework path in Xcode project
Re: Framework path in Xcode project
- Subject: Re: Framework path in Xcode project
- From: Chris Espinosa <email@hidden>
- Date: Wed, 02 Jun 2010 12:30:58 -0700
On Jun 2, 2010, at 8:23 AM, Markus Spoettl <email@hidden> wrote:
> When I "Get Info" on any of these added frameworks, I get this:
>
> Path: /System/Library/Frameworks/<name>.framework
> Full Path: /System/Library/Frameworks/<name>.framework
> Path Type: Absolute Path
>
> Yesterday - meanwhile using Xcode 3.2.1 on Snow Leopard - I added Security.framework and the path information is this:
>
> Path: System/Library/Frameworks/Security.framework
> Full Path: /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/Security.framework
> Path Type: Relative to Current SDK
>
> I also noticed the UI for adding the framework changed from a File/Directory Open dialog to some dedicated UI.
>
> Why the change? If it's because of the Base SDK, why are the other frameworks unchanged? Is it safe? Is it safe the set up the paths the same way the previously added frameworks are (I tried and it appears to be)?
>
> I don't like inconsistencies, much less ones I can't understand. Please enlighten me.
Be prepared for enlightenment...
In the Ur-times, before SDKs, all Framework references were absolute, and all frameworks were only in /System/Library/Frameworks. The compiler assumed this, and in fact framework references were passed to the compiler and linker by name only, and the path was assumed.
When SDKs were introduced in Xcode 1.0, the Xcode build system implemented them by re-basing all absolute framework paths into the designated SDK and passing those as absolute paths into the compiler. For backwards compatibility the project's absolute path rerences were not changed. So your project might say you were using /System/Library/Frameworks/Foo.framework but Xcode would actually pass /Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks/Foo.framework to the compiler and linker. This happened silently and tended to confuse people, as navigation and indexing would use a different framework from building.
Then the compiler learned about SDKs and started taking an -isysroot command-line option. This made things easier as Xcode could pass shorter framework flags, and everything would be built from the same SDK. Xcode also started being a little smarter about using frameworks form SDKs for indexing and navigation. Pretty much the only thing used about a framework was its name; the absolute path was rarely used.
Then the iPhone entered the picture, and it became important to really distinguish SDKs because the versions of, say, CoreFoundation can be fairly different between SDKs. And a new Library and Frameworks sheet was added to navigate directly to an SDK's frameworks, rather than making you grope in the file system for them. And the Active SDK popup was introduced to let you switch from one SDK to another on the fly without changing your project settings, to let you switch from the Device to Simulator easily.
With all these it became important to break the absolute path convention and store references to frameworks Relative to Current SDK. That is the standard for newly-added framework references and for new projects and targets. But old code still has the absolute paths, which are still by and large ignored, with the current SDK overriding them (most of the time).
In short: the inconsistency is due to the multiyear transition from system-focused development to SDK-focused development, and is an artifact of backwards compatibility. You can, and probably should, change your framework references to SDK-relative at your convenience, but that should make little or no immediate difference in your projects or workflow.
Chris _______________________________________________
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