# PETSc error on Ubuntu 20.04 (WSL2)

**URL:** <https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793>\
**Category:** FreeFEM installation\
**Created:** [June 2, 2022, 8:50am UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793 "2022-06-02T08:50:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![RodZ](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@RodZ](https://community.freefem.org/u/RodZ)\
**Post date:** [June 2, 2022, 8:50am UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793/1 "2022-06-02T08:50:49Z")

</div>

Hi to everyone,

I have Windows 11 system and also WSL2. Now, i want to use FreeFem in WSL2 (Ubuntu) to execute some softwares, but I don’t know why I have problems with PETSc.  
In Windows it works without problems, but when i run for example:  
ff-mpirun -np 4 heat-2d-PETSC.edp

The output is:  
ff-mpirun -np 4 heat-2d-PETSC.edp  
‘/usr/bin/mpiexec’ -np 4 /usr/local/bin/FreeFem+±mpi -nw ‘heat-2d-PETSC.edp’  
[LAPTOP-V20KJ0G9:01388] \*\*\* Process received signal \*\*\*  
[LAPTOP-V20KJ0G9:01388] Signal: Segmentation fault (11)  
[LAPTOP-V20KJ0G9:01388] Signal code: Address not mapped (1)  
[LAPTOP-V20KJ0G9:01388] Failing at address: (nil)  
[LAPTOP-V20KJ0G9:01388] [0] /lib/x86\_64-linux-gnu/libc.so.6(+0x43090)[0x7faeb4565090]  
[LAPTOP-V20KJ0G9:01388] \*\*\* End of error message \*\*\*  
/usr/local/bin/ff-mpirun: line 46: 1388 Segmentation fault ‘/usr/bin/mpiexec’ -np 4 /usr/local/bin/FreeFem+±mpi -nw ‘heat-2d-PETSC.edp’

If i try to run a script that only says 'load “PETSc” ’ , doing FreeFem+±mpi  
I get:  
– FreeFem++ v4.1 (Thu Dec 16 11:57:44 CET 2021 - git v4.10)  
file : test.edp  
Load: lg\_fem lg\_mesh lg\_mesh3 eigenvalue parallelempi  
1 : load “PETSc”  
Load error: PETSc  
fail:  
dlerror : /lib/x86\_64-linux-gnu/libmpi\_mpifh.so.40: undefined symbol: mpi\_conversion\_fn\_null\_  
list prefix: ‘/usr/lib/freefem++/’ ‘./’ ‘/usr/local/lib/ff++/4.10/lib/mpi/’ list suffix: ‘’ , ‘.so’  
current line = 1 mpirank 0 / 1  
Load error : PETSc  
line number :1, PETSc  
error Load error : PETSc  
line number :1, PETSc  
code = 2 mpirank: 0

Any idea where this error come from? Thanks in advance,  
Rodrigo

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [June 2, 2022, 9:15am UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793/2 "2022-06-02T09:15:10Z")

</div>

Under unix use

ff-mpirun -np 4 ‘heat-2d-PETSC.edp’

to launch freefem+±mpi (I think you use a bad mpi lib).

---

<div class="post-metadata">

**Author:** ![RodZ](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@RodZ](https://community.freefem.org/u/RodZ)\
**Post date:** [June 2, 2022, 9:53am UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793/3 "2022-06-02T09:53:20Z")

</div>

Thanks for your answer @frederichecht, but it didn’t work, same error as before

> > ff-mpirun -np 4 ‘heat-2d-PETSc.edp’  
> > ‘/usr/bin/mpiexec’ -np 4 /usr/local/bin/FreeFem+±mpi -nw ‘heat-2d-PETSc.edp’  
> > [LAPTOP-V20KJ0G9:00690] \*\*\* Process received signal \*\*\*  
> > [LAPTOP-V20KJ0G9:00690] Signal: Segmentation fault (11)  
> > [LAPTOP-V20KJ0G9:00690] Signal code: Address not mapped (1)  
> > [LAPTOP-V20KJ0G9:00690] Failing at address: (nil)  
> > [LAPTOP-V20KJ0G9:00690] [0] /lib/x86\_64-linux-gnu/libc.so.6(+0x43090)[0x7f2d3dcfc090]  
> > [LAPTOP-V20KJ0G9:00690] \*\*\* End of error message \*\*\*  
> > /usr/local/bin/ff-mpirun: line 46: 690 Segmentation fault ‘/usr/bin/mpiexec’ -np 4 /usr/local/bin/FreeFem+±mpi -nw ‘heat-2d-PETSc.edp’

Bonne journée,  
Rodrigo

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [June 2, 2022, 10:29am UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793/4 "2022-06-02T10:29:36Z")

</div>

Can you tray a basic exemple with 4 proc svp.

[essai.edp](https://community.freefem.org/uploads/short-url/vKUIX6gKkgBDcRuGFET0We0aCUD.edp) (4.09 KB)

---

<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:** [June 2, 2022, 12:41pm UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793/5 "2022-06-02T12:41:12Z")

</div>

```auto
dlerror : /lib/x86_64-linux-gnu/libmpi_mpifh.so.40: undefined symbol: mpi_conversion_fn_null_

```

My guts tell me that you are using one MPI for `FreeFem++-mpi`, and another for PETSc. Could you please share your `config.log` and `3rdparty/ff-petsc/petsc-3.XY.Z/fr/lib/petsc/conf/configure.log`?

---

<div class="post-metadata">

**Author:** ![RodZ](https://avatars.discourse-cdn.com/v4/letter/r/ad7895/32.png) [@RodZ](https://community.freefem.org/u/RodZ)\
**Post date:** [June 3, 2022, 7:41am UTC](https://community.freefem.org/t/petsc-error-on-ubuntu-20-04-wsl2/1793/6 "2022-06-03T07:41:10Z")

</div>

Very thanks for your answers and your help to the FreeFem enthusiasts!

It didnt goork the file essai.edp (same error), so finally I installed ubuntu (dual) and FreeFem again. I think that it was the problem that says @prj, and i did something wrong in the compilation of source code.

It works very well now!
