mpif90 not finding the libraries with -Bstatic

Hi,

I am trying to compile a MPI program statically using the command: mpif90 myprogram.f90 -o myprogram -Bstatic and I get this error message:
/usr/bin/ld: cannot find -lmpi_f90

If I add the --showme option I get:

pgf90 -I/opt/openmpi-1.3.2/pgi/include -I/opt/openmpi-1.3.2/pgi/lib myprogram.f90 -o myprogram -Bstatic -L/opt/openmpi-1.3.2/pgi/lib -lmpi_f90 -lmpi_f77 -lmpi -lopen-rte -lopen-pal -ldl -Wl,–export-dynamic -lnsl -lutil -lpthread -ldl

and I can see that the required libraries are actually in /opt/openmpi-1.3.2/pgi/lib. However if I do ldd on one of those libraries I can see that they are dynamically linked. So something is probably wrong. Do you what the problem is?

Thanks, Christophe

Hi Christophe,

What is the output of “ls -l /opt/openmpi-1.3.2/pgi/lib”?

My best guess is that you don’t have static versions of OpenMPI libraries. If this is the case, you’ll need to rebuild and/or reinstall OpenMPI with the static libraries. http://www.pgroup.com/resources/openmpi/openmpi141_pgi2010.htm

  • Mat

Hi Mat,

Thanks. The output of ls -l /opt/openmpi-1.3.2/pgi/lib/libmpi_f90.so* is

lrwxrwxrwx 1 100 100 19 2009-07-02 22:33 /opt/openmpi-1.3.2/pgi/lib/libmpi_f90.so -> libmpi_f90.so.0.0.0
lrwxrwxrwx 1 100 100 19 2009-07-02 22:33 /opt/openmpi-1.3.2/pgi/lib/libmpi_f90.so.0 -> libmpi_f90.so.0.0.0
-rwxr-xr-x 1 100 100 32319 2009-07-02 22:33 /opt/openmpi-1.3.2/pgi/lib/libmpi_f90.so.0.0.0

I’ll try to find the static libraries or install them.

Hi,

You will need to update the wrapper so that the openmpi libraries is statically linked. Based on the information you gave, the wrappers are probably in /opt/openmpi-1.3.2/pgi/openmpi/shared/openmpi/mpi*-wrapper-data.txt. update a line with libs=… and manually put a fullpath to all *.a.

Note that we package openmpi with our compiler. They are precompiled and you can see use it directly.

Otherwise, you can look in those wrapper files for statically link examples.

Hongyon