问题
I'm using Xcode 4.5.2 on OS X 10.8.2. How do I know which version of LLVM compiler Xcode is using?
回答1:
From UI:
- Click on your project
- Choose a target (it may be choosen by default)
- Click on Build Settings tab
- Scroll it to see "Apple LLVM complier: X.X - Code generation"
X.X is version of your LLVM
回答2:
From the command line:
07:40:35 andrew@iMac SalesIQ (siq-303)$ llvm-gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured 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.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)
07:40:39 andrew@iMac SalesIQ (siq-303)$
回答3:
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 --version
Apple 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 --version
i686-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.
来源:https://stackoverflow.com/questions/14186490/how-to-check-the-llvm-compiler-version-xcode-is-using