Welcome to www.arepo-code.org › Forums › Arepo forum › The code is not working › compilation error – undefined reference to `ompi_mpi_comm_world’ › Reply To: compilation error – undefined reference to `ompi_mpi_comm_world’

Hi Konstantin,
Great you found a way around it.
I also just included a SYSTYPE=”Ubuntu” option in the Makefile, which should also solve your problem using OpenMPI.
Best,
Rainer
The general solution to such a problem is the following (assuming the libraries are installed):
If the compiler does not find e.g. the mpi.h file:
locate mpi.h
this should find the header of the library, like e.g.
/usr/lib/x86_64-linux-gnu/openmpi/include/mpi.h
Then, include the path in the compilation, adding it to one of the include options in the Makefile
MPICH_INCL= -I/usr/lib/x86_64-linux-gnu/openmpi/include/
If the compilation fails at linking, i.e. not finding a function of the library.
E.g. for the mpi library, the library option -lmpi is used, which translates to the library libmpi.so or libmpi.a
locate libmpi.*
The resulting path needs to be included in one of the *_LIB variables in the Makefile
MPICH_LIB = -L/usr/lib/x86_64-linux-gnu/openmpi/lib/ -lmpi
instead of just
MPICH_LIB = -lmpi