Compiling GCC 5 on OS X
原文: https://solarianprogrammer.com/2015/05/01/compiling-gcc-5-mac-os-x/
准备工作
go to: http://gcc.gnu.org/mirrors.htm downloading the last stable version of GCC from the GNU website
mpc
mpfr
gmp
goto ftp://gcc.gnu.org/pub/gcc/infrastructure/ and download isl-xxx.tar.bz2
gmp
cd gmp*
mkdir build && cd build
../configure –prefix=/usr/gcc-5.1.0 –enable-cxx
make -j 2
sudo make install
mpfr
cd mpfr*
mkdir build && cd build
../configure –prefix=/usr/gcc-5.1.0 –with-gmp=/usr/gcc-5.1.0
make -j 2
sudo make install
mpc
cd mpc*
mkdir build && cd build
../configure –prefix=/usr/gcc-5.1.0 –with-gmp=/usr/gcc-5.1.0 –with-mpfr=/usr/gcc-5.1.0
make -j 2
sudo make install
isl
cd isl*
mkdir build && cd build
../configure –prefix=/usr/gcc-5.1.0 –with-gmp-prefix=/usr/gcc-5.1.0
make -j 2
sudo make install
gcc
cd gcc*
mkdir build && cd build
../configure –prefix=/usr/gcc-5.1.0 –enable-checking=release –with-gmp=/usr/gcc-5.1.0 –with-mpfr=/usr/gcc-5.1.0 –with-mpc=/usr/gcc-5.1.0 –enable-languages=c,c++,fortran –with-isl=/usr/gcc-5.1.0 –program-suffix=-5.1.0
make -j 2
sudo make install
echo "export PATH=/usr/gcc-5.1.0/bin:$PATH" >> ~/.bashrc
g++-5.1.0 test.cpp -o test