0

I am compiling gcc 8.5 from source on a linux cluster in my home directory (no root access).

I have exported -L/MYHOME/lib/' to CFLAGS, LDFLAGS, LD_LIBRARY_PATH and I am using "sh configure --prefix=/MYHOME" but the compilation stops at: /usr/bin/ld: cannot find -lmpc

Passing the -L flag should be sufficient, as a simple test works:

gcc main.c -lmpc -L /MYHOME/lib

Is there a way to include a user directory into the ld search path without having root access?

Thank you for your help.

q086as
  • 1
  • 2
  • It depends on which stage it fails. GCC is initially built with the host compiler and then it uses the freshly built GCC to rebuild itself. If it fails in this phase, you may be successful with `configure --with-boot-ldflags='-L/MYHOME/lib'`. – raspy Apr 25 '22 at 13:04
  • Did you read the directions on how to build GCC and follow them _exactly_? In particular, the "prerequisites" and "configuration" sections? If you follow the directions, it will work. If you do something different, it probably won't work. I recommend you use the download_prerequisites script rather than try to build them yourself outside of the GCC build. – MadScientist Apr 25 '22 at 14:39

1 Answers1

0

thank you very much for your suggestions. I found the issue and solved the problem. In essence, I needed these additional flags to configure:

sh ../gcc-6.5.0/configure --prefix=/home/xyz/ --build=x86_64-linux-gnu --enable-languages=c,c++,fortran --with-mpfr=/home/xyz/ --with-gmp=/home/xyz/ --with-mpc=/home/xyz/

These posts were helpful: 1, 2, 3

Thank you again for the time you have invested to help me.

q086as
  • 1
  • 2