15 Sep 2011
Compiling PowerPC with LLVM GCC 4.2 in Xcode 4.1 on 10.7
There have been a number of excellent articles describing how to restore various older technologies to Xcode 4 (10.4 SDK, 10.5 SDK, GCC 4.0, PPC). Thanks to mecki for doing such a good job detailing the steps. The only trouble is those steps didn’t work for me in one case: PowerPC support. Luckily, it’s easy to restore.
Here is the short C code I compiled to test the process:
I compiled the C code with LLVM GCC 4.2 (Xcode 4’s default compiler), specifying the PowerPC architecture with 10.6 SDK. Then I used lipo to check the binary’s architecture.
I installed Xcode 4.1 on my 10.7 system and then copied files from Xcode 3.2.5 on my 10.6 system into /Xcode3 on my 10.7 system. Here are the files I included:
Here are the shell commands that I used to finally get LLVM GCC 4.2 to compile with PowerPC:
One last hurdle was Xcode 4’s build settings. I had to specify “ppc” not only in “Valid Architectures” but also in “Architectures”, along with $(ARCHS_STANDARD_32_64_BIT).
Xcode 4.3 Update: Restore 10.5 support simply by symlinking your existing 10.5 SDK to the following path inside Xcode.app: