# Feature-request : use --download-mpich on Ubuntu

**URL:** https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407
**Category:** FreeFEM installation
**Created:** [May 13, 2020, 2:42pm UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407 "2020-05-13T14:42:57Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![ffeppon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ffeppon/32/1011_2.png) [@ffeppon](https://community.freefem.org/u/ffeppon)
#### Post date: [May 13, 2020, 2:42pm UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/1 "2020-05-13T14:42:57Z")

</div>

Dear FreeFEM developpers

After most struggle to compile FreeFEM on Ubuntu 20.04, I found that many problems can be avoided if PETSc is compiled beforehand as suggested by [Compiling with your own PETSc and SLEPc builds](https://community.freefem.org/t/compiling-with-your-own-petsc-and-slepc-builds/225/12) and by [http://jolivet.perso.enseeiht.fr/FreeFem-tutorial/#pfc0](http://jolivet.perso.enseeiht.fr/FreeFem-tutorial/#pfc0).

It seems that the mpich or openmpi available from the ubuntu public repositories are somehow broken or hard to configure properly for the compilation. I also attempted to install from the provided .deb but I have an issue with the version of gfortran.

However everything seems to run fine if we follow these steps:

- Install and compile PETSc first with

```bash
PREFIX="/usr/local/ff-petsc/r/"
sudo ./configure --with-cc=gcc --with-cxx=g++ --with-fc=gfortran \
    --download-mumps --download-parmetis --download-mpich --download-fblaslapack \
    --download-metis --download-hypre --download-slepc \
    --download-hpddm --download-ptscotch \
    --download-suitesparse \
    --download-scalapack \
    --with-fortran-bindings=no \
    --with-scalar-type=real \
    --with-debugging=no \
    --prefix=$PREFIX

```

This automatically install a working mpich. Note that on my environment “–download-fblaslapack” is needed because the MUMPS of the ubuntu repository is too old and its libraries will create conflict when compiling FreeFEM.

- One should need to do the same for PETSc complex and adapting to use the mpich of PETSc real
- Then set the mpi compilers to be those of PETSc:

```auto
export MPIPREFIX="/usr/local/ff-petsc/r/bin"
export MPICC="$MPIPREFIX/mpicc"
export MPICXX="$MPIPREFIX/mpicxx"
export MPIF77="$MPIPREFIX/mpif77"
export MPIFC="$MPIPREFIX/mpif90"
export MPIRUN="$MPIPREFIX/mpirun"

```

- Finally run configure and compile:

```auto
./configure --enable-download --enable-optim -with-mpi=mpich
./3rdparty/getall -a
make
sudo make install

```

I made a script which attempts to do all this (verified on kubuntu 20.04) which is maintained here:

> <https://gitlab.com/florian.feppon/software-recipes/-/blob/public-master/install_freefem_ubuntu.sh>

I suspect it could help many ubuntu users if there would be an option to use --download-mpich of PETSc on the FreeFEM configure which would reproduce my suggestion, or if these instructions would be clearly suggested on the FreeFEM doc page.

Many thanks for all the work you are doing

Best

---

<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: [May 29, 2020, 8:20am UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/2 "2020-05-29T08:20:02Z")

</div>

Dear Florian,  
I’ve just pushed a [new commit](https://github.com/FreeFem/FreeFem-sources/commit/2f0b54a3709ada2e49f0635d5100f586b8919a3f) in the develop branch so that if no MPI implementation is detected during `./configure`, the flag `--download-mpich` will automatically be added for you when running `make petsc-slepc`. Then, during `./reconfigure`, FreeFEM will pick up the PETSc-generated wrappers `mpirun`, `mpic++`, `mpic`, and `mpif90` if you have Fortran installed. Having MPI installed is not a requirement anymore for using PETSc/SLEPc.

Thank you for the feature request 🙂

PS: I still do prefer and recommend to power users to have their PETSc installation on the side, like you are doing in your post, since it’s easier to update and adapt, e.g., specific downloaded libraries and such.

---

<div class="post-metadata">

### Author: ![ffeppon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ffeppon/32/1011_2.png) [@ffeppon](https://community.freefem.org/u/ffeppon)
#### Post date: [September 18, 2020, 12:32pm UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/3 "2020-09-18T12:32:54Z")

</div>

Hi prj,

Thanks for the update!

By the way in the mean time I passed to Fedora and I noticed that the recent version 10 of gcc and gfortran create some retrocompatibility problems at the compilation, see e.g. [https://gcc.gnu.org/gcc-10/porting\_to.html#argument-mismatch](https://gcc.gnu.org/gcc-10/porting_to.html#argument-mismatch).

One should use the c/cpp flag `-fcommon` and the gfortran flag `-fallow-argument-mismatch`: e.g. using these exports before running ./configure:

```bash
export FCFLAGS="-fallow-argument-mismatch"
export FFLAGS="-fallow-argument-mismatch"
export CFLAGS="-fcommon"
export CXXFLAGS="-fcommon"

```

So I updated my recipe here (on fedora ow but it works also for ubuntu):

> <https://gitlab.com/florian.feppon/software-recipes/-/blob/public-master/install_freefem_fedora.sh>

Best

---

<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: [September 18, 2020, 2:19pm UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/4 "2020-09-18T14:19:55Z")

</div>

I usually recommend people to just `--disable-fortran`. What are those `CFLAGS` and `CXXFLAGS` for, please?

---

<div class="post-metadata">

### Author: ![ffeppon](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/ffeppon/32/1011_2.png) [@ffeppon](https://community.freefem.org/u/ffeppon)
#### Post date: [September 21, 2020, 9:21am UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/5 "2020-09-21T09:21:06Z")

</div>

Hi Pierre,

If we do --disable-fortran, then it is still possible to compile all third party packages ?  
The -fcommon flag is needed now for the compilation of mmg with gcc10 (otherwise there are linker errors). The reason for this is explained here [https://gcc.gnu.org/gcc-10/porting\_to.html](https://gcc.gnu.org/gcc-10/porting_to.html).

Best  
Florian

---

<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: [September 21, 2020, 9:37am UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/6 "2020-09-21T09:37:13Z")

</div>

OK, I guess the Mmg error should be reported upstream, and I don’t think it would be too difficult to fix?  
If you do:

```auto
$ ./configure --enable-download --prefix=~/FreeFem-install
$ cd 3rdparty/ff-petsc && make petsc-slepc
$ ./reconfigure --disable-fortran 

```

Then, you’ll get _most_ (not _all_) third party packages. The missing ones will be ARPACK (but you’ll have SLEPc), Ipopt, MUMPS\_seq.

With the upcoming release of PETSc 3.14.0 (scheduled September 29), you’ll also get ARPACK with these steps (may be tested using the branch `petsc-3.14.0`).

---

<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: [September 21, 2020, 11:19am UTC](https://community.freefem.org/t/feature-request-use-download-mpich-on-ubuntu/407/7 "2020-09-21T11:19:35Z")

</div>

> The -fcommon flag is needed now for the compilation of mmg with gcc10

Hasn’t this been fixed for a while? [ftbfs with gcc 10 · Issue #72 · MmgTools/mmg · GitHub](https://github.com/MmgTools/mmg/issues/72)
