Installing with non-standard prefix fails - please help

Jonathan Wakely
Tue Aug 30 12:40:00 GMT 2011

On 30 August 2011 12:43, H_Jarausch wrote:
> Hi,
> I need to install gcc-4.7-SVN onto a machine where I don't have root access.
> I'd like to install with the  /kurs/cpp prefix. For doing so, I configure
> like
> CFLAGS='-L/kurs/cpp/lib' LDFLAGS="-L/kurs/cpp/lib -Wl,-rpath,/kurs/cpp/lib"
> \
>  ./configure --prefix=/kurs/cpp --enable-languages="c++" \
>                  --with-gmp=/kurs/cpp --with-mpfr=/kurs/cpp
> --with-mpc=/kurs/cpp
> Still I get a configure error when the new gcclib is built:
> configure:3540: checking for suffix of object files
> configure:3562: /kurs/cpp/Src/gcc-4.7-110729/host-i686-pc-linux-gnu/gcc/xgcc
> -B/kurs/cpp/Src/gcc-4.7-110729/host-i686-pc-linux-gnu/gcc/
> -B/kurs/cpp/i686-pc-linux-gnu/bin/ -B/kurs/cpp/i686-pc-linux-gnu/lib/
> -isystem /kurs/cpp/i686-pc-linux-gnu/include -isystem
> /kurs/cpp/i686-pc-linux-gnu/sys-include    -c -g -L/kurs/cpp/lib  conftest.c
> /kurs/cpp/Src/gcc-4.7-110729/host-i686-pc-linux-gnu/gcc/cc1: error while
> loading shared libraries: cannot open shared object file: No
> such file or directory
> There is a valid symlink  /kurs/cpp/lib/ to
> /kurs/cpp/lib/  and ldd /kurs/cpp/lib/ doesn't
> show any problems.
> So, what am I missing for building gcc-4.7-SVN in my case.
> Many thanks for a hint,

You didn't read the docs for --with-gmp etc. at

"You might also need to ensure the shared libraries can be found by
the dynamic linker when building and using GCC, for example by setting
the runtime shared library path variable (LD_LIBRARY_PATH on GNU/Linux
and Solaris systems). "

As Marc said, the easiest method is to build gmp/mpfr/mpc with
--disable-shared, or simply to put them in the gcc source tree as
documented at

Also, do not run ./configure, as documented at

Building GCC is not trivial, but we've tried to document the important
bits, particularly this VERY frequently asked question, so please take
the time to read the documentation.

More information about the Gcc-help mailing list