2016-10-03 85 views
0

我对安装了OS X Yosemite(10.10.5)的Mac上安装的gcc版本感到困惑。我也安装了Xcode v6.3.1。在Mac(Yosemite)上安装了哪个版本的gcc

输入下面的命令显示以下信息:

gcc -v 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/c++/4.2.1 
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) 
Target: x86_64-apple-darwin14.5.0 
Thread model: posix 

clang -v 
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn) 
Target: x86_64-apple-darwin14.5.0 
Thread model: posix 

which gcc 
/usr/bin/gcc 

which clang 
/usr/bin/clang 

据我所知,GCC不是别名铿锵。

有人请赐教我这是什么意思?

回答

3

在较新版本的XCode中,gcc和clang链接到SDK中的相同二进制文件。铿锵会说它至少是gcc 4.2,这有点奇怪,但适用于大量检查gcc的软件,它通常兼容。

[email protected] ~> /usr/bin/clang -v 
Apple LLVM version 7.3.0 (clang-703.0.31) 
Target: x86_64-apple-darwin15.6.0 
Thread model: posix 
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 
[email protected] ~> /usr/bin/gcc -v 
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/include/c++/4.2.1 
Apple LLVM version 7.3.0 (clang-703.0.31) 
Target: x86_64-apple-darwin15.6.0 
Thread model: posix 
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin 

如果你看一下目录InstalledDir,你可以看到实际存在的程序。

+0

有关'InstalledDir'的信息来自哪里?当我运行'clang -v'时,我没有看到。 – ksl

+0

看起来我的铿锵至少比你的发布更新,可能是新的,这是我的猜测。尝试更新您的xcode。 – echristo

0

我有一个类似的问题,我想知道我应该在优胜美地上安装哪个版本的gcc,因为大多数UNIX工具都需要GCC,所以它是一个至关重要的软件包。

如果gcc -version未显示版本,则表示您没有该版本。

你需要先安装一个gcc,然后检查它的版本!滑稽?但根据您的Xcode命令行和操作系统版本,您没有太多选择,让brew决定应该安装哪个版本,还会安装依赖关系。

要安装GCC,

  1. 安装自制From HomeBrew Website
  2. 打开终端
  3. 运行命令:冲泡安装gcc

我已经安装了GCC刚才,这里是快照,请注意以下图片中的相关模块名称和gcc版本,它们是Yosemite量身定制的:

enter image description here