# Getting the petsc plugin with external petsc libs

**URL:** <https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221>\
**Category:** FreeFEM installation\
**Created:** [September 22, 2021, 4:43pm UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221 "2021-09-22T16:43:52Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cfo](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@cfo](https://community.freefem.org/u/cfo)\
**Post date:** [September 22, 2021, 4:43pm UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221/1 "2021-09-22T16:43:52Z")

</div>

Hi,

We have FreeFem++ installed on our HPC Clusters but it seems like the PETSc plugin is missing :  
attempting to run the poisson example from the tutorial, i get the following error :  
Load error : PETSc  
line number :10, PETSc

Indeed, when attempting to reinstall with :  
‘–with-slepc-include= -I/…/slepc-3.12.1/intel–20.0.0\_\_openmpi–4.0.1/default/include/’  
‘–with-slepc-ldflags=-L/…/slepc-3.12.1/intel–20.0.0\_\_openmpi–4.0.1/default/lib/ -lslepc’  
‘–with-petsc=/…/petsc-3.12.2/intel–20.0.0\_\_openmpi–4.0.1/default/lib/petsc/conf/petscvariables’  
‘–enable-hpddm’  
‘–with-hpddm-include=-I/…/hpddm-3.14/intel–20.0.0\_\_openmpi–4.0.1/default/include’  
‘–with-hpddm-ldflags=-L/lib -lhpddm\_c -lhpddm\_fortran’

looking at the config.log, i get :  
configure:23515: ++ add hpddm : -L/lib -lhpddm\_c -lhpddm\_fortran ; -I/…/hpddm-3.14/intel–20.0.0\_\_openmpi–4.0.1/default/include in plugin/seq  
[…]  
configure:25642: FreeFEM used download: no  
configure:25644: – Dynamic load facility: yes  
configure:25646: – ARPACK (eigen value): yes  
configure:25648: – UMFPACK (sparse solver): yes  
configure:25650: – BLAS: yes  
configure:25652: – with MPI: yes  
configure:25654: – with PETSc: yes / PETSc complex: no  
configure:25656: – with SLEPc: yes / SLEPc complex: no  
configure:25658: – with hpddm: no  
configure:25660: – with htool: no  
configure:25662: – with bemtool: no (need boost: no and htool: no)  
configure:25664: – without libs: tetgen mmg3d mmg parmmg mshmet gmm ipopt mumps\_seq nlopt superlu umfpack yams pipe MMAP NewSolver hpddm bem  
configure:25666: – without plugins: tetgen.so mmg3d-v4.0.so mmg.so parmmg.so mshmet.so aniso.so ilut.so ff-Ipopt.so MUMPS\_seq.so MUMPS.so ff-NLopt.so SuperLu.so UMFPACK64.so freeyams.so pipe.so ff-mmap-semaphore.so NewSolver.so hpddm.so hpddm\_substructuring.so PETSc.so function-PETSc.so SLEPc.so bem.so  
configure:25670: progs: FreeFem+±nw bamg cvmsh2 FreeFem+±mpi ffmedit ffglut  
configure:25866: PETSc directories do not exist, to build do:  
configure:25868: cd 3rdparty/ff-petsc && make

From what i understood so far, the load “PETSc” is reffering to the PETSc plugin which cannot be built using an external install of petsc, slepc and hpddm because of how the configure.ac and resulting configure are written (the checking for the hpddm install from petsc conf sets ff\_hpddm\_ok, whereas the check for the hpddm install from configure options does not and happends after the discarding of the petsc plugin anyways).  
Is this understanding correct or am i missing something ?  
Is there a way to build freefem with the petsc plugin using pre-existing installs of these tools ?  
(we might use a patched version of petsc or might have to patch it in the future and would like to avoid having another installation to manage if possible)

Best Regards  
Clement

---

<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 22, 2021, 5:01pm UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221/2 "2021-09-22T17:01:23Z")

</div>

It’s definitely possible. You can see one example with proper flags there: [using prebuilt PETSc when building from source? · Issue #128 · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/issues/128#issuecomment-586738836).  
First thing that looks suspicious is the use of relative paths instead of absolute paths.  
Once you fix those, if it’s still not working, please provide the _complete_ `config.log`.  
If your security clearance is high enough at TGCC, I can mail the path to my installations on Irène at [hotline.tgcc@cea.fr](mailto:hotline.tgcc@cea.fr) (or directly to you profil email address), you’ll simply need to pick up my `config.param` and `./reconfigure`, I use custom PETSc installations as well.

---

<div class="post-metadata">

**Author:** ![cfo](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@cfo](https://community.freefem.org/u/cfo)\
**Post date:** [September 23, 2021, 9:29am UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221/3 "2021-09-23T09:29:35Z")

</div>

Hi,

Thanks for the quick reply.

These are absolute paths, i just obfuscated them.  
Taking a look at your install own may help a ton. Please provide username, which machine it is installed on and path to install to this account email address.

The only major difference i see between with the arguments provided in the example you link is that both petsc and petsc complex are provided. Is that necessary for building the PETSc plugin ?  
Also i do provide  
‘–enable-hpddm’  
‘–with-hpddm-include=-I/…/hpddm-3.14/intel–20.0.0\_\_openmpi–4.0.1/default/include’  
‘–with-hpddm-ldflags=-L/lib -lhpddm\_c -lhpddm\_fortran’  
and the logs show  
configure:23515: ++ add hpddm : -L/lib -lhpddm\_c -lhpddm\_fortran ; -I/…/hpddm-3.14/intel–20.0.0\_\_openmpi–4.0.1/default/include in plugin/seq  
but still  
configure:25658: – with hpddm: no

Providing the complete config.log requites specific clearance. I will ask for it but i’m unsure when the response will come.

---

<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 23, 2021, 9:40am UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221/4 "2021-09-23T09:40:58Z")

</div>

I’ve sent you an email with the appropriate information.  
With respect to HPDDM, there is no need to compile the libraries, in that scenario, only the headers are needed (so no need for `--with-hpddm-ldflags`). But without the full log, it’s though for me to understand why it’s not being picked up. I’ll try to reproduce this on my own.

---

<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 23, 2021, 10:34am UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221/5 "2021-09-23T10:34:46Z")

</div>

I have been able to reproduce the problem. Could you add the flag `--enable-download_hpddm` (which in fact, will _not_ download HPDDM but use what you provide in the option `--with-hpddm-include`) and see if this fixes your issue?

---

<div class="post-metadata">

**Author:** ![cfo](https://avatars.discourse-cdn.com/v4/letter/c/d9b06d/32.png) [@cfo](https://community.freefem.org/u/cfo)\
**Post date:** [September 23, 2021, 11:19am UTC](https://community.freefem.org/t/getting-the-petsc-plugin-with-external-petsc-libs/1221/6 "2021-09-23T11:19:59Z")

</div>

Yes !  
It looks like it enabled both hpddm and PETSc.so.

Thanks for the help. I will come back if i encounter more issues with this installation ahah.
