Uli's Web Site
[ Zathras.de - Uli's Web Site ]
Other Sites: Stories
Pix
Abi 2000
Stargate: Resurgence
Lost? Site Map!
 
 
     home | blog | moose | programming | articles >> blog

 Blog
 
 Archive
 
 Blog Topics
 

15 Most Recent [RSS]

 Less work through Xcode and shell scripts
2011-12-16 @600
 
 iTunesCantComplain released
2011-10-28 @954
 
 Dennis Ritchie deceased
2011-10-13 @359
 
 Thank you, Steve.
2011-10-06 @374
 
 Cocoa Text System everywhere...
2011-03-27 @788
 
 Blog migration
2011-01-29 @520
 
 All you need to know about the Mac keyboard
2010-08-09 @488
 
 Review: Sherlock
2010-07-31 @978
 
 Playing with Objective C on Debian
2010-05-08 @456
 
 Fruit vs. Obst
2010-05-08 @439
 
 Mixed-language ambiguity
2010-04-15 @994
 
 Uli's 12:07 AM Law
2010-04-12 @881
 
 Uli's 1:24 AM Law
2010-04-12 @874
 
 Uli's 6:28 AM Law
2010-04-12 @869
 
 Uli's 3:57 PM Law
2010-04-12 @867
 

More...

Mac OS X 10.2 through 10.4 Intel compatibility

Since a casual google didn't bring up anything that covered this, I thought I'd collect what I found out about maintaining compatibility with Mac OS X 10.4 for Intel all the way back to 10.2 here. To do this, you need Xcode 2.2 or later and you need to have installed the appropriate cross-development SDKs (i.e. 10.2.8 and 10.4u) along with it. The actual setup is a pretty straightforward operation with one or two under-documented spots.

[Screenshot of the SDK popup]

Open your project in Xcode and choose "Edit Project Settings" from the "Project" menu (or just double-click your project's icon at the top of the "Groups & Files" outline view). On the "General" tab, select the 10.2.8 target SDK from the popup menu. Switch to the "Build" tab in there and select "Deployment" from the "Configuration" popup.

[Screenshot of the project settings]

Now, select the "SDK Path" there and copy it, then add a new setting called SDKROOT_ppc and paste in the 10.2 SDK's path as its value. Then go back to "General" and switch the target SDK to "10.4 (Universal)". Now, on regular compiles, you will get the 10.4u SDK, while on PowerPC builds, SDKROOT_ppc will override the SDK to use the 10.2 SDK. Next, set the "Mac OS X Deployment Target" to "Mac OS X 10.4", and add another override MACOSX_DEPLOYMENT_TARGET_ppc that overrides this for PowerPC. Set its value to "10.2", i.e. don't write "MacOS X" before it as it's for the other setting.

The final ingredient to 10.2.8 compatibility is that 10.2 apps can't be compiled with GCC4, because GCC 4 uses shared libraries (aka DLLs or dylibs) for the standard library, while GCC3 used to use a static library there. So, specify the GCC_VERSION_ppc key and enter "3.3" as the value.

[Screenshot of the Project menu]

Compile for deployment (by selecting "Project" -> "Set Active Build Configuration" -> "Deployment" from the menu bar and then building) and you should get a 10.2 PowerPC app. Once it runs, go back to the Project Settings and specify "i386 ppc" as the value for the "architectures" setting. This will make Xcode generate a universal binary and compile each file twice, once for Intel and once for PowerPC.

Since PowerPC is on the way out, I chose to make the Intel settings the defaults, while the PowerPC settings are in the overrides. If you want to, you can also do it the other way round: Set the defaults to 10.2.8 stuff (which will also make it easier to avoid accidental 10.2 incompatibilities because the headers don't even contain 10.3+ features), and use SDKROOT_i386, MACOSX_DEPLOYMENT_TARGET_i386 and GCC_VERSION_i386 to override them for Intel.

Oh, and BTW: While you're in that window: There are lots of handy options like "deployment post-processing" and "strip debug symbols using post-processing" that you want to turn on for release builds to make your executables smaller.

PS - If you want to know more, check out the Xcode Help. Do a search for "universal" and you'll get the chapter on "Building Universal Binaries" that describes the architecture-dependent setting names.

Reader Comments: (RSS Feed)
No comments yet
Comment on this article:
Name:
E-Mail: (not shown, hashed for Gravatar)
Web Site URL: (optional)
Comment: (plain text only)
Please Enter the following word:
Or E-Mail Uli privately.

 
Created: 2006-03-06 @717 Last change: 2006-03-23 @869 | Home | Admin | Edit
© Copyright 2003-2014 by M. Uli Kusterer, all rights reserved.