Problem linking 3rdparty/parmmg

Hi, everyone,
I need help with compiling latest version of FreeFem from source. I have problem compiling FreeFem after git pull command. I have tons of undefined references errors related to OpenMPI, for example:

/usr/bin/ld: ../3rdparty/parmmg/parmmg-sources/src/parmmg.c:76: undefined reference to 'ompi_mpi_comm_world'
/usr/bin/ld: ../3rdparty/parmmg/parmmg-sources/src/parmmg.c:311: undefined reference to 'ompi_mpi_op_min'

The gcc command that produce this error is:

/usr/bin/g++  -DUSE_MPI -g  -DNDEBUG -O3 -mmmx -mavx -std=c++14 -DBAMG_LONG_LONG  -DNCHECKPTR -fPIC -std=c++14 -fPIC -O3 -DNDEBUG  -Wl,-Bsymbolic-functions -rdynamic CMakeFiles/parmmg.dir/src/parmmg.c.o  -o bin/parmmg_O3  -Wl,-rpath,/home/piotr/FreeFem-install/ff-petsc/r/lib: lib/libparmmg.a /home/piotr/FreeFem-install/ff-petsc/r/lib/ /home/piotr/Projects/FreeFem-sources/3rdparty/mmg/build/lib/libmmg.a -lmpichcxx -lmpich -lmpich /home/piotr/FreeFem-install/ff-petsc/r/lib/libscotch.a /home/piotr/FreeFem-install/ff-petsc/r/lib/libscotcherrexit.a -lpthread -lz -lm -lrt -lm

The problem is obviously related to the fact that I use MPICH as an MPI implementation, whereas the source requires OpenMPI for some reason. I have both the libraries installed in my system, but I autoreconf choose MPICH. Is there any config option to force using OpenMPI, or, may be some switch in parmmg to use MPICH ?

Do you really need both MPI implementations on your system? This usually leads to such problems…
You should be able to force the use of MPICH by specifying during configuration ./configure MPICC=your_mpich_wrapper MPICXX=your_mpich_wrapper MPIFC=your_mpich_wrapper.

Thanks for the answer.
Reinstalling the source, reconfiguring, and rebuilding ff-petsc helped to tackle the problem. Yet now I am stuck in the following error

/usr/bin/mpic++ -c -fPIC '-I../seq/include' '-I/home/piotr/Projects/FreeFem-sources/3rdparty/include/' '-I/home/piotr/Projects/FreeFem-sources/3rdparty/include/' '-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi' '-I/usr/lib/x86_64-linux-gnu/openmpi/include' '-I/usr/local/ff-petsc/r/include' '-I/usr/local/ff-petsc/r/include' -g -DNDEBUG -O3 -mmmx -mavx -std=c++14 -DBAMG_LONG_LONG -DNCHECKPTR -fPIC -I/usr/local/ff-petsc/r/include -I/usr/include/hdf5/serial -I/usr/include 'parmmg.cpp'
parmmg.cpp: In member function 'virtual AnyType parmmg_Op::operator()(Stack) const':
parmmg.cpp:290:42: error: 'PMMG_IPARAM_opnbdy' was not declared in this scope
   if (nargs[i]) PMMG_Set_iparameter(mesh,PMMG_IPARAM_opnbdy,        arg(i,stack,0L)); i++;   /*!< [0/1], Enable preservation of open boundaries */

Though I see that the symbol is defined in libparmmg.h I can’t find parmmg.cpp (only parmmg.c) to check it out.

I keep the both implementation of MPI because there are some other projects that (may) require different libraries.

You are using an old ParMmg version. You probably have to go in 3rdparty/parmmg and do something like make clean followed by make, whatever it takes to reinstall the latest version of ParMmg.

Thanks, that has helped