2013-01-04 43 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