Tutorial For Creating Universal Binaries
Written by: Chad Armstrong (chad@edenwaith.com)
Created: 26. February 2006
Last modified: 27. May 2006
When the Intel-based Macintosh computers were first revealed, it was shown that creating a program to be able to run on both Intel and PowerPC processors could be as simple as clicking a button. The keyword here being could. If you are starting up a new project, geared for only Mac OS 10.4, then this might be a fairly straightforward process. Otherwise, it might take a little extra work to get a Universal Binary working properly.
In the efforts to convert some older Edenwaith projects like Untar and Permanent Eraser to Universal Binaries, yet still remain backwards compatible with pre-Panther systems, I had to jump through several extra hoops.
- Get the latest tools
-
Get the latest version of Xcode. At the time of this writing, the most recent version of Xcode was 2.3.
- Upgrade To Native Target
-
If you have an older project, especially one which was originally generated with Project Builder (the precursor to Xcode), then you will need to first upgrade your application to a native application. This was the most important step that was often not mentioned before being able to compile your application as a Universal Binary.
Select your project in the Groups & Files window, and then go to Project → Upgrade To Native Target menu. If you have multiple targets you'd like to upgrade, then select the Upgrade All Targets In Project To Native.
- Set Build Target Settings
-
Cross-Develop Using Target SDK: <Multiple values >
Architectures: ppc i386
Turn off Prebinding and Zerolink.
- Setting Compiler Variables
-
GCC_VERSION_i386 |
4.0 |
GCC_VERSION_ppc |
3.3 |
MACOSX_DEPLOYMENT_TARGET_i386 |
10.4 |
MACOSX_DEPLOYMENT_TARGET_ppc |
10.2 |
OTHER_LDFLAGS_ppc |
-prebind |
SDKROOT_i386 |
/Developer/SDKs/MacOSX10.4u.sdk |
SDKROOT_ppc |
/Developer/SDKs/MacOSX10.2.8.sdk |
- Troubleshooting
-
If Zerolink isn't turned off, this error might appear:
can't locate framework for: -framework ZeroLink
Command /usr/bin/gcc-3.3 failed with exit code 1
If you are compiling in Deployment mode, this should avoid some of these headaches since ZeroLink isn't turned on by default, only with Development.
Reference files
|
|