9

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?

fpiro07
  • 847
  • 1
  • 13
  • 18

1 Answers1

11

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.

trojanfoe
  • 120,358
  • 21
  • 212
  • 242
  • Doesn't work. I have downloaded the .pkg file and installed it via double-click. Afterwards I entered 'sudo port selfupdate' into my terminal an it says 'sudo: port: command not found' – user3182532 Jul 13 '15 at 01:42
  • Okay so you need to restart the terminal after the installation of macports! But still it doesn't work because when I enter g++ --version I see that I'm still at version 4.2.1 ... ! – user3182532 Jul 13 '15 at 01:58
  • 1
    You need to check that `/opt/local/bin` is in the `$PATH`. Check out the macports docs for details. – trojanfoe Jul 13 '15 at 05:10