3

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

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 来获取库。我再次运行配置,它给了我同样的错误。所以我也编译了它们,在我的 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 库链接。

有谁知道我应该怎么做?

4

0 回答 0