Trouble building GCC 4.8.2: cannot find -lmpc

时间:2016-06-10 16:13:19

标签: gcc ld configure mpc

When I try to compile GCC 4.8.0 as a part of a greater system, in a custom directory. I have no sudo rights on this server and therefore I'm building everything from source. However, I can't get the dependencies gmp, mpfr and mpc to work. When running configure it gives me:

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 gives me:

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

So I tried to get mpfr, gmp and mpc and build it manually from source, as I have no rights to install on the system itself. I ran ./contrib/download_prerequisites to get the libraries. I ran configure again, it gave me the same error. So I also compiled them and in my gcc dir I did:

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 ..

Note that just using --with-mpfr did not work for some reason.

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

where $SRC is my gcc directory. However, at the last command it gave me this error in the 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

It is obvious that after running make mpc does not have a lib directory, or anything containing shared object files. So I do not know how I have to link gcc with the mpc library.

Does anyone know what I should do?

0 个答案:

没有答案