OpenMPI libraries are incompatible with --as-needed in gcc's link command
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@
/usr/bin/ld: /tmp/cc3NLduM.
R_X86_64_64 relocation against symbol `mpi_fortran_
/usr/bin/ld: /tmp/cc3NLduM.
R_X86_64_64 relocation against symbol `mpi_fortran_
/usr/bin/ld: /tmp/cc3NLduM.
R_X86_64_64 relocation against symbol `mpi_fortran_
/usr/bin/ld: /tmp/cc3NLduM.
R_X86_64_64 relocation against symbol `mpi_fortran_
The solution is to remove --as-needed from the linker command line in gcc specs.
This issue is also described in http://
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