Public bug reported:

Write a file like this called main.f90:

program mpitest
  implicit none
  include 'mpif.h'
  logical :: flag
  integer :: ier
  call MPI_Init(ier)
  if (ier /= 0) then
    print *, 'Unable to initialize MPI: ', ier
    stop 1
  endif
  call MPI_Initialized(flag, ier)
  if (ier /= 0) then
    print *, 'Unable to check MPI initialization state: ', ier
    stop 1
  endif
  call MPI_Finalize(ier)
  if (ier /= 0) then
    print *, 'Unable to finalize MPI: ', ier
    stop 1
  endif
end program mpitest

Compile it like this:

gfortran  -I. -I/usr/lib/x86_64-linux-gnu/openmpi/include 
-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi 
-I/usr/lib/x86_64-linux-gnu/openmpi/lib -Wall -O0 -g -pthread -o main.f90.o -c 
main.f90
gfortran  -o exef main.f90.o -L/usr/lib/x86_64-linux-gnu/openmpi/lib 
-L/usr//lib -Wl,--start-group -lmpi_usempif08 -lmpi_usempi_ignore_tkr 
-lmpi_mpifh -lmpi -Wl,--end-group

The compile step will work but linking will fail with this error
message:

/usr/bin/ld: main.f90.o(.debug_info+0xd8): unresolvable R_X86_64_64 relocation 
against symbol `mpi_fortran_argv_null_'
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status

The same code compiles and links fine on Debian stable i386.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: gfortran 4:7.2.0-1ubuntu1
ProcVersionSignature: Ubuntu 4.13.0-16.19-generic 4.13.4
Uname: Linux 4.13.0-16-generic x86_64
ApportVersion: 2.20.7-0ubuntu3.1
Architecture: amd64
CurrentDesktop: KDE
Date: Wed Oct 25 21:49:05 2017
InstallationDate: Installed on 2017-10-14 (10 days ago)
InstallationMedia: Kubuntu 17.04 "Zesty Zapus" - Release amd64 (20170412)
SourcePackage: gcc-defaults
UpgradeStatus: Upgraded to artful on 2017-10-25 (0 days ago)

** Affects: gcc-defaults (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug artful

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1727474

Title:
  gfortran fails to link openmpi programs

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-defaults/+bug/1727474/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to