Installing GCC 4.7.1 on OS X

2019-02-13 18:40发布

问题:

I am trying to install GCC 4.7.1 on my Mac because I want to update the LLVM GCC 4.2 given in XCode.

I have downloaded GCC 4.7.1 and I've placed the gcc-4.7.1 folder in ~/Downloads, then I followed the instructions given here: http://gcc.gnu.org/install/ and I wrote

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

and the configuration does show problems.

Then I wrote

make

and it all goes well until I am given this message

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

Then the make check gives me this message

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

And the make install this 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

How can I fix these problems and have my GCC 4.7.1 installed?

回答1:

Install MacPorts and run:

$ sudo port selfupdate
$ sudo port install gcc47

It will take care of correctly configuring and installing gcc (4.7.2 at the time of writing) and all dependencies.



回答2:

You can download a signed Installer package here: https://www.litebeam.net/macosx/macosx/gcc.html