XCode5 removed LLVM GCC 4.2 compiler options as documented in Xcode 5.0.1 Release Notes

  1. You will need to Download the last Xcode4 which is Xcode4.6.3 from https://developer.apple.com/downloads/index.action?name=Xcode#

xcode4.6.3.png

OR grab these:

LLVMGCC4.2.xcplugin.tar.gz
llvm-gcc-4.2.tar.gz

Note: Double-click xcode4xxxxxx.dmg to mount it, but do not install that Xcode version! We just need to grab the LLVM-GCC42 plugin and binaries and copy them over to XCode5.

  1. Extract LLVMGCC4.2.xcplugin.tar.gz to Xcode’s Plugin-ins directory
cp LLVMGCC4.2.xcplugin.tar.gz /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/
cd /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/
tar -zxvf LLVMGCC4.2.xcplugin.tar.gz

You will see something like

drwxr-xr-x@ 3 rupert  admin   102B 10 Oct 18:20 Clang LLVM 1.0.xcplugin/
drwxr-xr-x@ 3 rupert  admin   102B 10 Oct 18:20 Core Data.xcplugin/
drwxr-xr-x@ 3 rupert  admin   102B 10 Oct 18:20 CoreBuildTasks.xcplugin/
drwxr-xr-x@ 3 rupert  admin   102B 10 Oct 18:20 IBCompilerPlugin.xcplugin/
drwxr-xr-x@ 3 rupert  admin   102B 28 Sep 11:22 IBStoryboardCompilerPlugin.xcplugin/
drwxr-xr-x  3 rupert  admin   102B 27 Nov 10:32 LLVM GCC 4.2.xcplugin/
drwxr-xr-x@ 3 rupert  admin   102B 10 Oct 18:20 Scene Kit.xcplugin/
  1. Extract the llvm-gcc binary to /Applications/Xcode.app/Contents/Developer/usr
cp llvm-gcc-4.2.tar.gz /Applications/Xcode.app/Contents/Developer/usr
cd /Applications/Xcode.app/Contents/Developer/usr
tar -zxvf llvm-gcc-4.2.tar.gz
% cd /Applications/Xcode.app/Contents/Developer/usr
total 0
drwxr-xr-x@ 77 rupert  admin   2.6K 27 Nov 10:53 bin/
drwxr-xr-x@ 36 rupert  admin   1.2K 12 Oct 17:02 lib/
drwxr-xr-x@  3 rupert  admin   102B 14 Aug 08:55 libexec/
drwxr-xr-x   7 rupert  admin   238B 27 Nov 10:48 llvm-gcc-4.2/
drwxr-xr-x@  8 rupert  admin   272B 12 Oct 17:02 share/
drwxr-xr-x@  6 rupert  admin   204B 14 Aug 09:00 subversion-1.6/
  1. Symlink the binaries from /Applications/Xcode.app/Contents/Developer/usr/bin
cd /Applications/Xcode.app/Contents/Developer/usr/bin
ln -s ../llvm-gcc-4.2/bin/llvm-cpp-4.2 llvm-cpp-4.2
ln -s ../llvm-gcc-4.2/bin/llvm-g++-4.2 llvm-g++
ln -s ../llvm-gcc-4.2/bin/llvm-g++-4.2 llvm-g++-4.2
ln -s ../llvm-gcc-4.2/bin/llvm-gcc-4.2 llvm-gcc
ln -s ../llvm-gcc-4.2/bin/llvm-gcc-4.2 llvm-gcc-4.2
  1. In your Xcode project, you can now choose the LLVM-GCC42 option
    llvm_gcc_42.png

References:
http://devernay.free.fr/hacks/xcodelegacy/
http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy.sh