How to check the LLVM compiler version Xcode is using?
From the command line:
07:40:35 andrew@iMac SalesIQ (siq-303)$ llvm-gcc -vUsing built-in specs.Target: i686-apple-darwin11Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 - enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~67/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1Thread model: posixgcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)07:40:39 andrew@iMac SalesIQ (siq-303)$
It depends on your build settings; you have a choice of Clang or llvm-gcc, and an iOS build may use a different one from OSX. To see exactly which version was used, expand a compile selection of a build log for something like “Compile ViewController.m
.” There will be a line like “/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x …
”
or
“/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 -x…
”
Select the path to the compiler, and in Terminal execute the following:
8> /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --versionApple clang version 4.1 (tags/Apple/clang-421.11.66) (based on LLVM 3.1svn)…
or
9> /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/llvm-gcc-4.2 --versioni686-apple-darwin10-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2410.2.00)…
Note that the Apple Clang versioning is distinct from both the GCC versioning and the open-source LLVM.