Bug 217750 - net/openmpi, net/openmpi2 require -rpath when non-default gcc is used
Summary: net/openmpi, net/openmpi2 require -rpath when non-default gcc is used
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Danilo Egea Gondolfo
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-13 12:42 UTC by Anton Shterenlikht
Modified: 2017-07-16 21:33 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (danilo)


Attachments
openmpi2 (410 bytes, patch)
2017-05-21 19:09 UTC, Danilo Egea Gondolfo
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Anton Shterenlikht 2017-03-13 12:42:04 UTC
With non-default GCC in /etc/make.conf,
e.g. DEFAULT_VERSIONS=gcc=6 there is an anomaly
between net/mpich, net/openmpi and net/openmpi2.

$ /usr/local/bin/mpif90 --version
GNU Fortran (FreeBSD Ports Collection) 6.3.1 20161229
$ /usr/local/bin/mpif90 z.f90
$ /usr/local/bin/mpirun -np 3 ./a.out
 node           1 : Hello world
 node           2 : Hello world
 node           0 : Hello world

However, with openmpi (same with net/openmpi2):

$ /usr/local/mpi/openmpi/bin/mpif90 --version
GNU Fortran (FreeBSD Ports Collection) 6.3.1 20161229
$ /usr/local/mpi/openmpi/bin/mpif90 z.f90
$ /usr/local/mpi/openmpi/bin/mpirun -np 3 ./a.out
-------------------------------------------------------
Primary job  terminated normally, but 1 process returned
a non-zero exit code.. Per user-direction, the job has been aborted.
-------------------------------------------------------
/lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc49/libgfortran.so.3 not found
/lib/libgcc_s.so.1: version GCC_4.6.0 required by /usr/local/lib/gcc49/libgfortran.so.3 not found

so I need to pass -rpath to mpif90:

$ /usr/local/mpi/openmpi/bin/mpif90 -Wl,-rpath="/usr/local/lib/gcc6" z.f90
$ /usr/local/mpi/openmpi/bin/mpirun -np 3 ./a.out
 node           0 : Hello world
 node           1 : Hello world
 node           2 : Hello world

I'd prefer openmpi and openmpi2 to behave as mpich.

This helps ports such as lang/opencoarrays, which can be
built with a selection of MPI ports.
Comment 1 Walter Schwarzenfeld freebsd_triage 2017-04-06 08:15:18 UTC
Add to /etc/libmap.conf:
libgcc_s.so.1   gcc5/libgcc_s.so.1
Comment 2 Anton Shterenlikht 2017-04-18 11:10:19 UTC
To w.schwarzenfeld@utanet.at:
Sorry I don't get you.
Is this the advice for the end user?
Or are you saying the port should do this?
Comment 3 Walter Schwarzenfeld freebsd_triage 2017-04-18 11:26:03 UTC
Sorry, it seems I was in the wrong PR.
Comment 4 Anton Shterenlikht 2017-05-15 15:47:14 UTC
ping
Comment 5 Danilo Egea Gondolfo freebsd_committer 2017-05-21 19:09:10 UTC
Created attachment 182781 [details]
openmpi2
Comment 6 Danilo Egea Gondolfo freebsd_committer 2017-05-21 19:15:42 UTC
Can you try the attached patch? I'm not sure if this "problem" should be fixed in OpenMPI though. One can simply use these flags in the application Makefile.

Probably there is a better way to pass this flags to linker, change the wrapper with a hard coded value is not a good solution, IMHO.

Ideas/patches are welcome.
Comment 7 Anton Shterenlikht 2017-05-22 14:03:25 UTC
Thanks!

Before I try the patch...

I see in net/mpich/Makefile:

     40 MPICH_LDFLAGS=  -Wl,-rpath=${LOCALBASE}/lib/gcc${_GCC_VER} \
     41                 -L${LOCALBASE}/lib/gcc${_GCC_VER} -B${LOCALBASE}/bin

To me this looks better than your

-rpath=/usr/local/lib/gcc${GCC_DEFAULT}

The point is that this problem only occurs when
non-default GCC is used.

Do you want to coordinate this change with tijl@
(maintainer of net/mpich)?
Comment 8 Danilo Egea Gondolfo freebsd_committer 2017-05-22 14:58:42 UTC
Cool. I'll test it asap.

Thanks!
Comment 9 commit-hook freebsd_committer 2017-07-09 20:17:39 UTC
A commit references this bug:

Author: danilo
Date: Sun Jul  9 20:16:50 UTC 2017
New revision: 445409
URL: https://svnweb.freebsd.org/changeset/ports/445409

Log:
  - Update to 1.10.7
  - Use external libevent
  - Force the wrapper to use rpath pointing to the correct GCC directory.
    This solves a problem (bug 217750) when a non-default GCC version is used.

  PR:		217750

Changes:
  head/net/openmpi/Makefile
  head/net/openmpi/distinfo
  head/net/openmpi/pkg-plist
Comment 10 commit-hook freebsd_committer 2017-07-09 21:04:17 UTC
A commit references this bug:

Author: danilo
Date: Sun Jul  9 21:03:59 UTC 2017
New revision: 445411
URL: https://svnweb.freebsd.org/changeset/ports/445411

Log:
  - Update to 2.1.1
  - Force the wrapper to use rpath pointing to the correct GCC directory.
    This solves a problem (bug 217750) when a non-default GCC version is used.

  PR:		217750

Changes:
  head/net/openmpi2/Makefile
  head/net/openmpi2/distinfo
  head/net/openmpi2/pkg-plist