mkdir -p gcc463
cd gcc463
#get the source
curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
curl -O ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
curl -O http://ftp.gnu.org/gnu/gcc/gcc-4.6.3/gcc-4.6.3.tar.bz2
#untar
tar xjf gmp-4.3.2.tar.bz2
tar xjf mpfr-2.4.2.tar.bz2
tar xzf mpc-0.8.1.tar.gz
tar xjf gcc-4.6.3.tar.bz2
(2) Build it
- buildgcc463.sh Select all
#!/bin/bash
export CXX=/usr/bin/g++
export CC=/usr/bin/gcc
export CPP=/usr/bin/cpp
export LD=/usr/bin/ld
export RANLIB=/usr/bin/ranlib
export AS=/usr/bin/as
export AR=/usr/bin/ar
GMP="`pwd`/gmp-4.3.2"
MPFR="`pwd`/mpfr-2.4.2"
MPC="`pwd`/mpc-0.8.1"
GCC_SRC="`pwd`/gcc-4.6.3"
PREFIX=~/local
if [ ! -f $PREFIX/lib/libgmp.dylib ] ; then
rm -fr $GMP/build
mkdir -p $GMP/build
cd $GMP/build
echo "configure gmp ..."; ../configure --prefix=$PREFIX --build=x86_64-apple-darwin11
echo "building gmp ..."; make && make install
fi
if [ ! -f $PREFIX/lib/libmpfr.dylib ] ; then
rm -fr $MPFR/build
mkdir -p $MPFR/build
cd $MPFR/build
pwd
echo "configure mpfr ..."; ../configure --prefix=$PREFIX --with-gmp=$PREFIX --build=x86_64-apple-darwin11
echo "building mpfr ..."; make && make install
fi
if [ ! -f $PREFIX/lib/libmpc.dylib ] ; then
rm -fr $MPC/build
mkdir -p $MPC/build
cd $MPC/build
echo "configure mpc ..."; ../configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --build=x86_64-apple-darwin11
echo "building mpc ..."; make && make install
fi
rm -fr $GCC_SRC/build
mkdir -p $GCC_SRC/build
cd $GCC_SRC/build
../configure --prefix=$PREFIX --with-gmp=$PREFIX --with-mpfr=$PREFIX --with-mpc=$PREFIX --enable-checking=release --program-suffix=-4.6.3 --enable-languages=c,c++,objc,obj-c++
make -j 4 && make install
(3) Test it
- test_lambda.cpp Select all
//Program to test the new C++11 lambda syntax
#include <iostream>
using namespace std;
int main()
{
cout << [](int m, int n) { return m + n; } (2, 4) << endl;
return(0);
}
~/local/bin/g++-4.6.3 -std=c++0x test_lambda.cpp -o test_lambda
./test_lambda