如何检查 Xcode 使用的 LLVM 编译器版本?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14186490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to check the LLVM compiler version Xcode is using?
提问by 4ae1e1
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?
我在 OS X 10.8.2 上使用 Xcode 4.5.2。我怎么知道 Xcode 使用的是哪个版本的 LLVM 编译器?
采纳答案by Victor Ronin
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"
- 点击你的项目
- 选择一个目标(默认情况下可以选择)
- 单击构建设置选项卡
- 滚动它以查看“Apple LLVM 编译器:XX - 代码生成”
X.X is version of your LLVM
XX 是你的 LLVM 的版本
回答by Andrew
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)$
回答by Flash Sheridan
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 …
”
这取决于您的构建设置;您可以选择 Clang 或 llvm-gcc,iOS 版本可能使用与 OSX 不同的版本。要准确查看使用的是哪个版本,请展开构建日志的编译选择,例如“ Compile ViewController.m
.”。会有像“ /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…
”
“ /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.
请注意,Apple Clang 版本控制不同于 GCC 版本控制和开源 LLVM。