building fortran

Vadim Gutnik
Wed Aug 23 09:08:00 GMT 2006

I'm having trouble building gfortran.

I tried to build gcc-4.1.1 from source, on

> uname -a
Linux 2.4.21-37.ELsmp #1 SMP Wed Sep 28 13:18:44
EDT 2005 x86_64 x86_64 x86_64 GNU/Linux

I built a local copy of gmp and mpfr, and because I don't have root,
put them in a nonstandard directory: /impinj/uns.

I then 
 setenv LDFLAGS "-Wl,--rpath -Wl,/impinj/uns/amd64_2.4/lib -Wl,--rpath -Wl,/impinj/uns/amd64_2.4/lib64"
 setenv LD_LIBRARY_PATH /impinj/uns/amd64_2.4/lib:/impinj/uns/amd64_2.4/lib64

...make a clean build directory, and configure like this:
../../../src/gcc-4.1.1/configure   --prefix=/impinj/uns   \
 --exec-prefix=/impinj/uns/amd64_2.4 --with-gmp=/impinj/uns/amd64_2.4 \
 --with-mpfr=/impinj/uns/amd64_2.4 --disable-multilib

then run 

 make install

This all builds without error.

However, if I then 
  unsetenv LD_LIBRARY_PATH 
and run 

 gfortran test.F

I get 

/impinj/uns/amd64_2.4/libexec/gcc/x86_64-unknown-linux-gnu/4.1.1/f951:relocation error:
/impinj/uns/amd64_2.4/libexec/gcc/x86_64-unknown-linux-gnu/4.1.1/f951:undefined symbol: __gmp_get_memory_functions

I also looked at:

 ldd `which gfortran` => /lib64/ (0x0000002a95682000)
        /lib64/ => /lib64/ (0x0000002a95556000)

 ldd /impinj/uns/amd64_2.4/libexec/gcc/x86_64-unknown-linux-gnu/4.1.1/f951 => /usr/lib64/ (0x0000002a95682000) => /lib64/ (0x0000002a957ba000)
        /lib64/ => /lib64/ (0x0000002a95556000)

So... what am I doing wrong? As I understand it, the LDFLAGS setting
should put the correct directories in the runtime link path. If I
don't set LD_LIBRARY_PATH at all, the "make" fails with an error about
(This bug might be related, but I can't tell:

Surely I don't need to always set LD_LIBRARY_PATH? Help? 


More information about the Gcc-help mailing list