Uli's Web Site
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.
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.
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.
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.
Created: 2006-03-06 @717 Last change: 2006-03-23 @869 | Home | Admin | Edit|
© Copyright 2003-2014 by M. Uli Kusterer, all rights reserved.