OpenMPI libraries are incompatible with --as-needed in gcc's link command

Bug #865353 reported by Dmitry Mikushin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
binutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

In Ubuntu 11.10 an application that links against libmpi_f77 of OpenMPI 1.5.4 or 1.4.3 built from source *FAILS* to link due to unresolvable relocations:

program main
include 'mpif.h'
integer ierr
call mpi_init(ierr)
end

marcusmae@loveland:~/Programming/mpitest$ mpif90 -g mpitest.f90
/usr/bin/ld: /tmp/cc3NLduM.o(.debug_info+0x542): unresolvable
R_X86_64_64 relocation against symbol `mpi_fortran_argv_null_'
/usr/bin/ld: /tmp/cc3NLduM.o(.debug_info+0x55c): unresolvable
R_X86_64_64 relocation against symbol `mpi_fortran_argv_null_'
/usr/bin/ld: /tmp/cc3NLduM.o(.debug_info+0x5d2): unresolvable
R_X86_64_64 relocation against symbol `mpi_fortran_errcodes_ignore_'
/usr/bin/ld: /tmp/cc3NLduM.o(.debug_info+0x5ec): unresolvable
R_X86_64_64 relocation against symbol `mpi_fortran_errcodes_ignore_'

The solution is to remove --as-needed from the linker command line in gcc specs.

This issue is also described in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=608901

Revision history for this message
Matthias Klose (doko) wrote :

looks like an issue with ld.bfd. you can work around it by using gold for now.

  mpif90 -B/usr/lib/gold-ld -g mpitest.f90

affects: gcc-4.6 (Ubuntu) → binutils (Ubuntu)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.