On 06.01.2011 22:40, Ralf Wildenhues wrote:
* 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?

yes, this works as expected.

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.

$ nm test.o
0000000000000000 t MAIN__
                 U _gfortran_set_args
                 U _gfortran_set_options
000000000000001b T main
0000000000000001 C mpi_fortran_argv_null_
0000000000000008 C mpi_fortran_argvs_null_
0000000000000004 C mpi_fortran_bottom_
0000000000000004 C mpi_fortran_errcodes_ignore_
0000000000000004 C mpi_fortran_in_place_
0000000000000014 C mpi_fortran_status_ignore_
0000000000000008 C mpi_fortran_statuses_ignore_
                 U mpi_init_
0000000000000000 r options.0.1778

$ objdump -T /usr/lib/libmpi_f90.so|grep argv
0000000000202c80 g    DO .bss   0000000000000008              
mpi_fortran_argv_null_
0000000000202c60 g DO .bss 0000000000000008 Base mpi_fortran_argvs_null_

$ nm -D /usr/lib/libmpi_f90.so|grep argv
0000000000202c80 B mpi_fortran_argv_null_
0000000000202c60 B mpi_fortran_argvs_null_

objdump doesn't show `Base' for this symbol.



--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to