building fortran

Vadim Gutnik gutnik@impinj.com
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 sockeye.impinj.com 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

and 
 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`
        libc.so.6 => /lib64/libc.so.6 (0x0000002a95682000)
        /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (0x0000002a95556000)

 
 ldd /impinj/uns/amd64_2.4/libexec/gcc/x86_64-unknown-linux-gnu/4.1.1/f951
        libgmp.so.3 => /usr/lib64/libgmp.so.3 (0x0000002a95682000)
        libc.so.6 => /lib64/libc.so.6 (0x0000002a957ba000)
        /lib64/ld-linux-x86-64.so.2 => /lib64/ld-linux-x86-64.so.2 (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
kinds.sh.
(This bug might be related, but I can't tell: 
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26893)

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

       Vadim



More information about the Gcc-help mailing list