# Petsc compilation with msys2/mingw64

**URL:** <https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846>\
**Category:** FreeFEM installation\
**Created:** [June 24, 2022, 1:18am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846 "2022-06-24T01:18:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [June 24, 2022, 1:18am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/1 "2022-06-24T01:18:12Z")

</div>

Hello,

- I try to compile my own petsc from the source code using msys2/mingw64 but i get an error “argument list too long” at the linker stage. I know it’s possible to split the compilation (–with-single-library=0 and that works) but i’d rather have only one petsc.dll file. Did you encounter that issue when compiling ?

- Do the files Petsc.dll and Petsc-complex.dll are freefem modules or original petsc shared libraries ? If there are ff modules, that mean they are compiled using petsc as static library ?

Thanks for helping.

PS : I read the petsc mail archive [here](https://lists.mcs.anl.gov/pipermail/petsc-dev/2018-February/022258.html) that @prj had the same problem in 2018.

---

<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 24, 2022, 5:54am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/2 "2022-06-24T05:54:34Z")

</div>

Which PETSc version are you trying to compile?

---

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [June 24, 2022, 8:34am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/3 "2022-06-24T08:34:04Z")

</div>

3.7.2  
Same problem occurs with older version

---

<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 24, 2022, 9:09am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/4 "2022-06-24T09:09:06Z")

</div>

3.7.2 is extremely old, please try a newer version.

---

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [June 24, 2022, 9:09am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/5 "2022-06-24T09:09:58Z")

</div>

Sorry it’s the 3.17.2 !

---

<div class="post-metadata">

**Author:** ![mrbenson](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@mrbenson](https://community.freefem.org/u/mrbenson)\
**Post date:** [June 24, 2022, 9:16am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/6 "2022-06-24T09:16:01Z")

</div>

The problem is not related to petsc but rather with msys2.  
Do you compile petsc as static library ?

---

<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 25, 2022, 8:06am UTC](https://community.freefem.org/t/petsc-compilation-with-msys2-mingw64/1846/7 "2022-06-25T08:06:02Z")

</div>

Yes, see [FreeFem-sources/Makefile at master · FreeFem/FreeFem-sources · GitHub](https://github.com/FreeFem/FreeFem-sources/blob/master/3rdparty/ff-petsc/Makefile#L112-L143).
