下面是编译脚本(具体参考LFS和GCC-configure)
# gmp
tar xvf gmp-5.0.1.tar.bz2
cd gmp-5.0.1/
./configure --prefix=/tools --enable-cxx --enable-mpbsd
make -j3
make install
cd ..
rm -fr gmp-5.0.1
tar xf mpfr-2.4.2.tar.bz2
cd mpfr-2.4.2/
make -j3
make install
rm -fr mpfr-2.4.2
# mpc
tar xvf mpc-0.8.1.tar.gz
./configure --with-mpfr=/tools --with-gmp=/tools --prefix=/tools
make install
rm -fr mpc-0.8.1
# gcc
cd gcc-4.5.0/
mkdir -v ../gcc-build
../gcc-4.5.0/configure --prefix=/tools --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-multilib --disable-bootstrap --with-gmp=/tools --with-mpfr=/tools --with-mpc=/tools
make install
cd ..
rm -fr gcc-build
rm -fr gcc-4.5.0
export PATH=/tools/bin:$PATH
gcc -v
出现的问题
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:10297: undefined reference to `mpfr_j1'
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:10303: undefined reference to `mpfr_y0'
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:10309: undefined reference to `mpfr_y1'
错误提示:
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:10430: undefined reference to `mpfr_jn'
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:10436: undefined reference to `mpfr_yn'
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:10444: undefined reference to `mpfr_remainder'
libbackend.a(builtins.o): In function `do_mpfr_remquo':
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:13344: undefined reference to `mpfr_remquo'
libbackend.a(builtins.o): In function `do_mpfr_lgamma_r':
/usr/src/gcc4/gcc-4.4.1/host-i686-pc-linux-gnu/gcc/../.././gcc/builtins.c:13422: undefined reference to `mpfr_lgamma'
collect2: ld returned 1 exit status
make[3]: *** [cc1-dummy] Error 1
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/usr/src/gcc4/gcc-4.4.1'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/src/gcc4/gcc-4.4.1'
make: *** [all] Error 2