I just upgraded to Xcode 4.2 and iOS SDK 5 earlier today. But everything seems different with new compilers.
There are two “Compiler for C/C++/Objective-C” options now, “Apple LLVM compiler 3.0” and “LLVM GCC 4.2”. GCC 4.2 is missing.
Apple LLVM compiler 3.0, builds really fast(I like that), gives me 999+ warnings, and my game can no longer run. It looks like there’s some differences on memory, and it crashes when loading our game’s scripts.
LLVM GCC 4.2 is so god damn slow, I still cannot finish one build after hours on my i7 machine.
And, one more thing is our engine uses gcc command lines to build(instead of xcode).
So, it leads to one question, how can I use gcc 4.2 in Xcode 4.2? Is that even possible?
Here is a way to enable compiling with gcc 4.2 in xcode 4.2. Most of this is done via command line so when you see lines like this:
[ 15:30 jon@MacBookPro / ]$, you need to open up a Terminal and run the command after the$.Download – but do not install yet – xcode_4.1_for_lion.dmg or xcode_4.1_for_snow_leopard.dmg
Now, follow these steps to install Xcode 4.1 into
/Developer-4.1:Backup the working
/Developerdirectory (where Xcode 4.2 is installed)Run the Xcode 4.1 installer using the default install location (
/Developer)Move the new Xcode 4.1 installation to
/Developer-4.1:Move the Xcode 4.2 developer directory back to
/Developer:Edit the Xcode 4.2
GCC 4.2.xcspecfile to get gcc 4.2 to show in the list of compiler options [1]:Change lines 41 and 42 from this:
To This:
Backup the Xcode 4.2 iOS/Simulator Framework
usrdirectories:Copy Xcode 4.1 iOS/Simulator Framework
usrdirectories to Xcode 4.2:Copy the
gccandinfoiOS SDK library directories from Xcode 4.1 to Xcode 4.2 [2]:Compile using gcc-4.2!
This is a blog post I’ve written with a little more info about this process. Feel free to leave a comment on the blog if you run into any issues or have any questions.
[1] If opening from a command line (using something like
vi,emacs,nano, etc) make sure to either enclose the path in quotes "/long path/with spaces/in it/file.xcspec" or escape the spaces /some/long\ path/with\ spaces/in\ it/file.xcspec[2] This is necessary because the iPhoneOS.platform SDK has its own seperate
/usr/libdirectories but the iPhoneSimulator.platform SDK does not