Vadim Gutnik wrote:
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)
IIRC, gmp and mpfr must be built with --enable-shared. It definitely
doesn't work to have gfortran picking up .so from a different version
from the one you installed and attempted to specify for configure.