当我尝试在自定义目录中编译GCC 4.8.0作为更大系统的一部分时 . 我在这台服务器上没有sudo权限,因此我正在从源代码构建所有内容 . 但是,我无法使依赖关系gmp,mpfr和mpc工作 . 运行configure时,它给了我:

configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify their locations.

config.log给了我:

configure:5619: checking for the correct version of the gmp/mpfr/mpc libraries
configure:5650: gcc -o conftest -g -O2 -Wno-error=unused-value -I$SRC/gmp/ -I$SRC/mpc/src/.libs -lmpc -lmpfr -lgmp >&5
/usr/bin/ld: cannot find -lmpc
collect2: ld returned 1 exit status

所以我试图获得mpfr,gmp和mpc并从源代码手动构建它,因为我无权在系统上安装它 . 我运行了./contrib/download_prerequisites来获取库 . 我再次运行configure,它给了我同样的错误 . 所以我也编译了它们,在我的gcc目录中我做了:

cd mpfr; ./configure; make
cd ../gmp; ./configure; make
cd ../mpc; ./configure --with-mpfr-include=$SRC/mpfr --with-mpfr-lib=$SRC/mpfr/.libs/ --with-gmp=$SRC/gmp; make; cd ..

请注意,仅使用--with-mpfr由于某种原因不起作用 .

cd $SRC/build
  ../configure \
    --build=x86_64-linux-gnu \
    CC=gcc \
    CFLAGS='-g -O2 -Wno-error=unused-value' \
    --disable-bootstrap --enable-checking=none \
    --disable-multi-arch --disable-multilib \
    --enable-languages=c,c++ \
    --with-gmp-lib=$SRC/gmp/.libs \
    --with-gmp-include=$SRC/gmp/ \
    --with-mpc-include=$SRC/mpc/src \
    --with-mpc=$SRC/mpc \
    --with-mpfr-lib=$SRC/mpfr/.libs \
    --with-mpfr-include=$SRC/mpfr \
    --prefix=$SRC/prefix

$ SRC是我的gcc目录 . 但是,在最后一个命令中,它在build / config.log中给了我这个错误:

gcc -o conftest -g -O2 -Wno-error=unused-value -I$SRC/gmp/ -I$SRC/mpfr -I$SRC/mpc/src    conftest.c  -L$SRC/gmp/.libs -L$SRC/mpfr/.libs -L$SRC/mpc/lib -lmpc -lmpfr -lgmp >&5
/usr/bin/ld: cannot find -lmpc
collect2: ld returned 1 exit status

很明显,运行后make mpc没有lib目录,或者包含共享对象文件的任何东西 . 所以我不知道如何将gcc与mpc库链接起来 .

有谁知道我应该怎么做?