2013-01-04 109 views
6

我试图在我的Mac上安装GCC 4.7.1,因为我想更新在XCode中给出的LLVM GCC 4.2。在OS X上安装GCC 4.7.1

我已经下载GCC 4.7.1,我已经放在gcc-4.7.1文件夹中~/Downloads,然后我跟着这里给出的说明:http://gcc.gnu.org/install/我写

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这messagge

/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?

回答

11

安装MacPorts和运行:

$ sudo port selfupdate 
$ sudo port install gcc47 

很会照顾的正确配置和(在写作的时候4.7.2)安装GCC和所有的依赖。

+0

感谢名单非常多,它的工作。 – fpiro07

+0

不起作用。我已经下载了.pkg文件并通过双击进行安装。之后,我在终端上输入'sudo port selfupdate',它显示'sudo:port:command not found' – user3182532

+0

好吧,所以您需要在安装macports后重新启动终端!但它仍然不起作用,因为当我输入g ++ --version时,我看到我仍然在版本4.2.1 ...! – user3182532