我很困惑我的Mac上安装了哪个版本的gcc,其上安装了OS X Yosemite(10.10.5)。我也安装了Xcode v6.3.1。
输入以下命令可显示以下信息:
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没有别名的铿锵声。
有人可以告诉我这意味着什么吗?
答案 0 :(得分:3)
在较新版本的XCode中,gcc和clang链接到SDK中的相同二进制文件。 clang会说它至少是gcc 4.2,这有点奇怪,但适用于许多检查gcc的软件,并且它通常是兼容的。
echristo@dzur ~> /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
echristo@dzur ~> /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目录,您可以看到实际存在的程序。
答案 1 :(得分:0)
I had a similar problem, I wanted to know what version of gcc should I install on my Yosemite, since most of UNIX tools need GCC it is a vital package.
if gcc -version doesn't shows the version, it means you do not have one.
you need to install a gcc first, then check for its version! funny? but according to your Xcode command line and OS version you have not a lot of options, let the brew decide which version you should install, It also installs dependencies.
To install GCC,
I have installed my GCC just now, here is the snapshot, notice the dependent module names and the gcc version at the following picture, they are Yosemite tailored :