在OS X上安装GCC 4.7.1

时间:2013-01-04 08:37:41

标签: macos shell gcc installation gnu

我正在尝试在我的Mac上安装GCC 4.7.1,因为我想更新XCode中提供的LLVM GCC 4.2。

我已下载GCC 4.7.1,我已将gcc-4.7.1文件夹放在~/Downloads中,然后我按照此处给出的说明操作:http://gcc.gnu.org/install/我写了< / p>

cd ~/Desktop
mkdir objdir
cd objdir
~/Downloads/gcc-4.7.1/configure --with-gmp=/usr/local/include --with-mpfr=/usr/local/include --with-mpc=/usr/local/include

并且配置确实显示问题。

然后我写了

make

这一切顺利,直到我收到此消息

rm -f stage_current
Comparing stages 2 and 3
warning: gcc/cc1-checksum.o differs
warning: gcc/cc1obj-checksum.o differs
warning: gcc/cc1plus-checksum.o differs
  Bootstrap comparison failure!
gcc/intl.o differs
make[2]: *** [compare] Error 1
make[1]: *** [stage3-bubble] Error 2
make: *** [all] Error 2

然后make check给了我这条消息

/bin/sh: line 0: cd: ./fixincludes: No such file or directory
make[1]: *** [check-fixincludes] Error 1
make: *** [do-check] Error 2

make install这个消息

/bin/sh /Users/fpiro07/Downloads/gcc-4.7.1/mkinstalldirs /usr/local /usr/local
/bin/sh: line 0: cd: ./fixincludes: No such file or directory
make[1]: *** [install-fixincludes] Error 1
make: *** [install] Error 2

如何修复这些问题并安装GCC 4.7.1?

2 个答案:

答案 0 :(得分:11)

安装MacPorts并运行:

$ sudo port selfupdate
$ sudo port install gcc47

它将负责正确配置和安装gcc(编写本文时为4.7.2)和所有依赖项。

答案 1 :(得分:2)

您可以在此处下载已签名的安装程序包:https://www.litebeam.net/macosx/macosx/gcc.html