Monday, December 3, 2012

Install GCC from scratch

Install GCC from scratch with GMP, MPFR, MPC, ELF, without shared libraries


GMP

GMP is the GNU Multiple Precision Arithmetic Library.

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2
bunzip2 gmp-4.3.2.tar.bz2
tar xvf gmp-4.3.2.tar
cd gmp-4.3.2
./configure --disable-shared --enable-static --prefix=/tmp/gcc
make && make check && make install

PFR is the GNU Multiple-precision floating-point rounding library. It depends on GMP.

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2
bunzip2 mpfr-2.4.2.tar.bz2
tar xvf mpfr-2.4.2.tar
cd mpfr-2.4.2
./configure --disable-shared --enable-static --prefix=/tmp/gcc --with-gmp=/tmp/gcc
make && make check && make install

MPC

MPC is the GNU Multiple-precision C library. It depends on GMP and MPFR.

wget ftp://gcc.gnu.org/pub/gcc/infrastructure/mpc-0.8.1.tar.gz
tar zxvf mpc-0.8.1.tar.gz
cd mpc-0.8.1
./configure --disable-shared --enable-static --prefix=/tmp/gcc --with-gmp=/tmp/gcc --with-mpfr=/tmp/gcc
make && make check && make install

ELF stands for Executable and Linkable Format. This library takes provides architecture-independent size and endian support.

wget http://www.mr511.de/software/libelf-0.8.13.tar.gz
tar zxvf libelf-0.8.13.tar.gz
cd libelf-0.8.13
./configure --disable-shared --enable-static --prefix=/tmp/gcc
make && make check && make install

GCC is the GNU Compiler Collection. It depends on GMP, MPFR, MPC, and ELF.

wget http://www.netgull.com/gcc/releases/gcc-4.6.2/gcc-4.6.2.tar.gz
tar zxvf gcc-4.6.2.tar.gz

We must build gcc in a scratch directory, so we create it on the same mount point (within /tmp would trigger cross compile host issues)

mkdir -p /opt/downloads/gcc-4.6.2
cd /opt/downloads/gcc-4.6.2


/opt/downloads/gcc-4.6.2/configure  --disable-shared --disable-bootstrap  --disable-libstdcxx-pch  --enable-languages=all  --enable-libgomp  --enable-lto  --enable-threads=posix  --enable-tls  --with-gmp=/tmp/gcc  --with-mpfr=/tmp/gcc  --with-mpc=/tmp/gcc  --with-libelf=/tmp/gcc  --with-fpmath=sse
make && make install

No comments: