GCC基础设施
获取GCC的依赖组件
ftp://gcc.gnu.org/pub/gcc/infrastructure/
- 下载文件到你想要的目录
~/Downloads
,或者/tmp/gcc
。 - 用静态库来配置make脚本。
$ ./configure --disable-shared --enable-static --prefix=/tmp/gcc
--disable-shared
这个选项值得走进看看。如果需要纯粹的二进制执行包,不依赖于任何动态库,这个选项就是你所需要的。
Versions
确认这些依赖库的版本,就是编译的GCC所要求的。怎么看?那就直接跑configure
里面会有提醒。
GMP
GNU Multiple Percision Arithmetric 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
MPFR
GNU Multiple-precision floating-point rounding library. 依赖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
GNU Multiple-precision C library. 依赖于GMP和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
ELF stands for Executable and Linkable Format. This library 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