# Problem linking 3rdparty/parmmg

**URL:** <https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727>\
**Category:** FreeFEM installation\
**Created:** [January 5, 2021, 1:58pm UTC](https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727 "2021-01-05T13:58:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![MPiotr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mpiotr/32/283_2.png) [@MPiotr](https://community.freefem.org/u/MPiotr)\
**Post date:** [January 5, 2021, 1:58pm UTC](https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727/1 "2021-01-05T13:58:18Z")

</div>

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:

```auto
/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:

```auto
/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/libmetis.so /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 ?  
Thanks.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 5, 2021, 2:12pm UTC](https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727/2 "2021-01-05T14:12:33Z")

</div>

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`.

---

<div class="post-metadata">

**Author:** ![MPiotr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mpiotr/32/283_2.png) [@MPiotr](https://community.freefem.org/u/MPiotr)\
**Post date:** [January 11, 2021, 7:54am UTC](https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727/3 "2021-01-11T07:54:52Z")

</div>

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

```auto
/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.

---

<div class="post-metadata">

**Author:** ![prj](https://avatars.discourse-cdn.com/v4/letter/p/ecae2f/32.png) [@prj](https://community.freefem.org/u/prj)\
**Post date:** [January 11, 2021, 7:59am UTC](https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727/4 "2021-01-11T07:59:39Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![MPiotr](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/mpiotr/32/283_2.png) [@MPiotr](https://community.freefem.org/u/MPiotr)\
**Post date:** [January 12, 2021, 7:03am UTC](https://community.freefem.org/t/problem-linking-3rdparty-parmmg/727/5 "2021-01-12T07:03:24Z")

</div>

Thanks, that has helped
