Bug 217682 - net/openmpi2: remove implicit -L/usr/local/lib
Summary: net/openmpi2: remove implicit -L/usr/local/lib
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
Depends on:
Blocks: 217283
  Show dependency treegraph
Reported: 2017-03-10 13:46 UTC by Tijl Coosemans
Modified: 2017-03-13 11:54 UTC (History)
1 user (show)

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

patch (2.03 KB, patch)
2017-03-10 13:46 UTC, Tijl Coosemans
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tijl Coosemans freebsd_committer 2017-03-10 13:46:51 UTC
Created attachment 180696 [details]

While working on a port of OpenCoarrays (bug 217283) it was discovered that Open MPI 2 runs the compiler with "-L/usr/local/lib" before "-L/usr/local/mpi/openmpi2/lib -lmpi".  You can verify this by running "/usr/local/mpi/openmpi2/bin/mpicc -show".  This causes /usr/local/lib/libmpi.so to be used if it exists instead of the Open MPI library.

-L/usr/local/lib is added by the configure script.  The attached patch changes CONFIGURE_ARGS to avoid this.  To allow the configure script to still find external libraries USES=localbase is added.  A post-patch command needed to be added to set the full path of hwloc.h like --with-hwloc=${LOCALBASE} does.  With --with-hwloc=external just the name "hwloc.h" is used.  This fails because the work directory contains its own hwloc.h which gets included instead of the system header.
Comment 1 commit-hook freebsd_committer 2017-03-12 16:12:10 UTC
A commit references this bug:

Author: danilo
Date: Sun Mar 12 16:11:48 UTC 2017
New revision: 435994
URL: https://svnweb.freebsd.org/changeset/ports/435994

  - Remove implicit -L/usr/local/lib
  - Simplify TORQUE option selection

  PR:		217682
  Submitted by:	tijl

Comment 2 Danilo Egea Gondolfo freebsd_committer 2017-03-12 16:14:22 UTC
Committed, thanks!
Comment 3 Anton Shterenlikht 2017-03-13 11:30:12 UTC
With this patch I still get:

$ /usr/local/mpi/openmpi2/bin/mpif90 z.f90
$ /usr/local/mpi/openmpi2/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.8.0 required by /usr/local/lib/gcc7/libgfortran.so.4 not found
/lib/libgcc_s.so.1: version GCC_4.8.0 required by /usr/local/lib/gcc7/libgfortran.so.4 not found
/lib/libgcc_s.so.1: version GCC_4.8.0 required by /usr/local/lib/gcc7/libgfortran.so.4 not found

so -rpath is still needed:

$ /usr/local/mpi/openmpi2/bin/mpif90 -Wl,-rpath="/usr/local/lib/gcc7" mpi.f90
$ /usr/local/mpi/openmpi2/bin/mpirun -np 3 ./a.out
 Hello from            2  out of            3  processes.
 Hello from            1  out of            3  processes.
 Hello from            0  out of            3  processes.

Or was the patch not intended to fix this?
Comment 4 Tijl Coosemans freebsd_committer 2017-03-13 11:54:12 UTC
No, you should open a separate bug about that.  This patch was to make it stop use /usr/local/lib/libmpi.so (from MPICH).