Reported by Roland Wirth, May 14, 2014
Steps to reproduce the problem: 1. Make sure that the MPI libs are not in the library path 2. ./configure --enable-mpi 3. make Expected result: Make should succeed. Actual result: libtool fails to link libparpack.so. Error is /bin/sh ../libtool --tag=F77 --mode=link mpif77 -g -O2 -no-undefined -version-info 2:0 -o libparpack.la -rpath /usr/local/lib64 ../SRC/libarpacksrc.la ../UTIL/libarpackutil.la ../PARPACK/SRC/MPI/libparpacksrcmpi.la ../PARPACK/UTIL/MPI/libparpackutilmpi.la -lblas -llapack -lmpi libtool: link: gfortran -shared -fPIC -Wl,--whole-archive ../SRC/.libs/libarpacksrc.a ../UTIL/.libs/libarpackutil.a ../PARPACK/SRC/MPI/.libs/libparpacksrcmpi.a ../PARPACK/UTIL/MPI/.libs/libparpackutilmpi.a -Wl,--no-whole-archive -lblas -llapack -lmpi -O2 -Wl,-soname -Wl,libparpack.so.2 -o .libs/libparpack.so.2.0.0 /usr/lib64/gcc/x86_64-suse-linux/4.8/../../../../x86_64-suse-linux/bi n/ld: cannot find -lmpi Reason seems to be that libtool knows nothing about the additional linker flags the compiler wrapper supplies so that, when it calls gfortran to link the .so, the linker is lacking the MPI library paths. The problem can be solved by setting the LIBRARY_PATH environment variable to include the appropriate paths in the make invocation, but this seems tedious to me. Another solution would be to have libtool call mpif77 as the linker instead of gfortran but I have no idea how to do that. The third solution is to use an Autoconf macro for the MPI configuration that I recently stumbled upon: this macro calls the MPI wrappers to get the compiler and linker flags explicitly so that MPI can be used like an ordinary library. The original macro can be found at https://github.com/tgamblin/libra/blob/master/m4/lx_find_mpi.m4 I've attached a modified version that I use for my own projects. It should be more portable and Fortran-compatible. However, I am not very experienced in writing Autoconf macros so there might be something I have missed.
- ax_find_mpi.m4 - 12.01 kB
Sign in to reply to this comment.