'modify ld library search path on cluster (no root access)

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.



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 q086as