Created attachment 180696 [details] patch 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.
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 Log: - Remove implicit -L/usr/local/lib - Simplify TORQUE option selection PR: 217682 Submitted by: tijl Changes: head/net/openmpi2/Makefile
Committed, thanks!
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?
No, you should open a separate bug about that. This patch was to make it stop use /usr/local/lib/libmpi.so (from MPICH).