Search code examples
openmpiopenfoam

openfoam openmpi error: libmpi.so.0 not found


Whenever I try to compile a solver in openfoam, I get the error:

/usr/bin/ld: warning: libmpi.so.0, needed by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopen-rte.so.0, needed by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so, not found (try using -rpath or -rpath-link)
/usr/bin/ld: warning: libopen-pal.so.0, needed by /opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so, not found (try using -rpath or -rpath-link)
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Waitall'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Abort'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `ompi_mpi_double'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Get_count'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Init'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Probe'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Send'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Allreduce'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `ompi_mpi_packed'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Buffer_detach'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Bsend'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `ompi_mpi_byte'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Irecv'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Recv'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `ompi_mpi_comm_world'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Get_processor_name'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Test'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Isend'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Finalize'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `ompi_mpi_op_sum'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Buffer_attach'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Comm_size'
/opt/openfoam211/platforms/linux64GccDPOpt/lib/openmpi-system/libPstream.so: undefined reference to `MPI_Comm_rank'
collect2: error: ld returned 1 exit status

I guess the problem is with the installation of open-mpi. How can I check/fix the error?


Solution

  • Firstly, check that you really have Open MPI installed.

    Secondly, check that OpenFOAM is properly set to use Open MPI: see corresponding options in etc/bashrc (or etc/cshrc). Also make sure you have set any needed environment variables for Open MPI (I do not have any experience with Open MPI, I build with Intel MPI, and there are some environment variables to be set by manually calling some script).

    Thirdly, check the link command lines issued by wmake to build your solver, and to build libPstream (during the main OpenFOAM build process). If it does not print the link line, edit wmake/Makefile to make it print out. Some of these lines (I think libPstream's) should feature some link options and most probably paths related to Open MPI.