[Pkg-openmpi-maintainers] Bug#608901: link failure with ld --as-needed

Ralf Wildenhues Ralf.Wildenhues at gmx.de
Thu Jan 6 21:40:10 UTC 2011


* Matthias Klose wrote on Tue, Jan 04, 2011 at 09:34:07PM CET:
> On 04.01.2011 20:56, Ralf Wildenhues wrote:
> >* Matthias Klose wrote on Tue, Jan 04, 2011 at 02:57:41PM CET:
> >>With gcc, gcc-4.5 and binutils from experimental, the following
> >>configure test (taken from petsc) fails with --as-needed:

> >>$ mpif90 test.F -Wl,--as-needed -Wall -Wno-unused-variable -g
> >>-I/usr/lib/openmpi/include -I/usr/lib/openmpi/lib
> >>-L/usr/lib/openmpi/lib -L/usr/lib/gcc/i686-linux-gnu/4.5.2 -ldl
> >>-lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread
> >>-ldl
> >>/usr/bin/ld: /tmp/cccq3IWF.o(.debug_info+0x48d): unresolvable
> >>R_X86_64_64 relocation against symbol `mpi_fortran_argv_null_'
> >[...]
> >>the error messages hint to an object file not built with -fPIC, but
> >>I didn't find one yet.
> >
> >Can you show -showme and -v output?

>  /usr/lib/gcc/x86_64-linux-gnu/4.5.2/collect2 --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=both -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/gcc/x86_64-linux-gnu/4.5.2/../../../../lib/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.5.2/../../../../lib/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.5.2/crtbegin.o -L/usr/lib/openmpi/lib -L/usr/lib/gcc/i686-linux-gnu/4.5.2 -L/usr/lib/openmpi/lib -L/usr/lib/gcc/x86_64-linux-gnu/4.5.2 -L/usr/lib/gcc/x86_64-linux-gnu/4.5.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.5.2/../../.. /tmp/ccqYKv1H.o --as-needed -ldl -lmpi -lopen-rte -lopen-pal -lnsl -lutil -lgcc_s -lpthread -ldl -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl --export-dynamic -lnsl -lutil -lgfortran -lm -ldl -lgfortran -lm -lgcc_s -lgcc -lpthread -lc -lgcc_s -lgcc /usr/lib/gcc/x86_64-linux-gnu/4.5.2/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.5.2/../../../../lib/crtn.o
> /usr/bin/ld: /tmp/ccqYKv1H.o(.debug_info+0x48d): unresolvable R_X86_64_64 relocation against symbol `mpi_fortran_argv_null_'
> /usr/bin/ld: /tmp/ccqYKv1H.o(.debug_info+0x4a7): unresolvable R_X86_64_64 relocation against symbol `mpi_fortran_argv_null_'
> /usr/bin/ld: /tmp/ccqYKv1H.o(.debug_info+0x511): unresolvable R_X86_64_64 relocation against symbol `mpi_fortran_errcodes_ignore_'
> /usr/bin/ld: /tmp/ccqYKv1H.o(.debug_info+0x52b): unresolvable R_X86_64_64 relocation against symbol `mpi_fortran_errcodes_ignore_'

Thanks.  libmpi_f90 should provide these symbols.  libmpi_f77 references
them on my system, but doesn't have a DT_NEEDED entry on libmpi_f90.so.0.

Can you wrap -lmpi_f90 in '-Wl,--no-as-needed ... -Wl,--as-needed' when
running commands manually, to see whether that fixes it?

Can you show nm output for the generated .o file?

I remember there have been GCC or binutils issues with as-needed and
symbols in common blocks, but can't find a reference now.

Thanks,
Ralf






More information about the Pkg-openmpi-maintainers mailing list