# FreeFem Installation PETSc config Error

**URL:** <https://community.freefem.org/t/freefem-installation-petsc-config-error/2065>\
**Category:** FreeFEM installation\
**Created:** [October 16, 2022, 9:08pm UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065 "2022-10-16T21:08:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![byb](https://avatars.discourse-cdn.com/v4/letter/b/71e660/32.png) [@byb](https://community.freefem.org/u/byb)\
**Post date:** [October 16, 2022, 9:08pm UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/1 "2022-10-16T21:08:35Z")

</div>

Hello all,

I am trying to install the new FreeFem version 4.11 on MacOs Monterey.  
I am getting this error message when I follow the steps of the installation.

I tried previous versions and get the same error message.

Do you have an idea from where this can come ?

Thank you

```auto
=============================================================================================
                         Configuring PETSc to compile on your system
=============================================================================================
============================================================================================= WARNING! Found environment variable: MAKEFLAGS=SUDO=sudo Ignoring it, since its also set on command line ============================================================================================= TESTING: checkFortranCompiler from config.setCompilers(config/BuildSystem/config/setCompilers.py:1748) *******************************************************************************
         UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
-------------------------------------------------------------------------------
Fortran compiler you provided with --with-fc=gfortran cannot be found or does not work.
Cannot compile/link FC with gfortran.
*******************************************************************************

make: *** [petsc-3.17.0/tag-conf-real] Error 1

```

and

config.log :

```auto
## ---------------------- ##
## Running config.status. ##
## ---------------------- ##

This file was extended by FreeFEM config.status 4.11, which was
generated by GNU Autoconf 2.71. Invocation command line was

  CONFIG_FILES =
  CONFIG_HEADERS =
  CONFIG_LINKS =
  CONFIG_COMMANDS =
  $ ../../config.status --file=Makefile.inc:Makefile-PETSc.inc

on PortYacine.local

config.status:1220: creating Makefile.inc

```

---

<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:** [October 17, 2022, 5:25am UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/2 "2022-10-17T05:25:03Z")

</div>

Could you please:

1. try the `develop` branch instead of `master`,
2. send `3rdparty/ff-petsc/petsc-3.18.0/configure.log` if the error persists.

---

<div class="post-metadata">

**Author:** ![byb](https://avatars.discourse-cdn.com/v4/letter/b/71e660/32.png) [@byb](https://community.freefem.org/u/byb)\
**Post date:** [October 17, 2022, 10:13pm UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/3 "2022-10-17T22:13:24Z")

</div>

> [@prj](#):
>
> 3rdparty/ff-petsc/petsc-3.18.0/

Thank you for your reply.  
I have tried with develop branch and observe the same error.

Unfortunatly, as I am a new user I cannot share the configure.log file.

Here the last part of the file.

```auto
===== Checking compiler
Executing: gfortran -c -o /var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers/conftest.o -I/var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers /var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers/conftest.F90 
Successful compile:
Source:
      program main

      end

===== Checking linker
Executing: gfortran -c -o /var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers/conftest.o -I/var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers /var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers/conftest.F90 
Successful compile:
Source:
      program main

      end

Executing: gfortran -o /var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers/conftest /var/folders/5z/jkmtl4fj6_qb47sgxkbnjn7h0000gn/T/petsc-zm5iwfo1/config.setCompilers/conftest.o 
Possible ERROR while running linker: exit code 1
stderr:
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
Linker output before filtering:

ld: library not found for -lSystem
collect2: error: ld returned 1 exit status
:
Linker output after filtering:

ld: library not found for -lSystem
collect2: error: ld returned 1 exit status:
          Error testing Fortran compiler: Cannot compile/link FC with gfortran.
            Deleting "FC"
*******************************************************************************
         UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
-------------------------------------------------------------------------------
Fortran compiler you provided with --with-fc=gfortran cannot be found or does not work.
Cannot compile/link FC with gfortran.
*******************************************************************************
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/configure.py", line 469, in petsc_configure
    framework.configure(out = sys.stdout)
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/framework.py", line 1404, in configure
    self.processChildren()
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/framework.py", line 1392, in processChildren
    self.serialEvaluation(self.childGraph)
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/framework.py", line 1367, in serialEvaluation
    child.configure()
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/setCompilers.py", line 2651, in configure
    self.executeTest(self.checkFortranCompiler)
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/base.py", line 138, in executeTest
    ret = test(*args,**kargs)
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/setCompilers.py", line 1755, in checkFortranCompiler
    for compiler in self.generateFortranCompilerGuesses():
  File "/Users/yacine/Desktop/FreeFem-sources-4.11/3rdparty/ff-petsc/petsc-3.17.0/config/BuildSystem/config/setCompilers.py", line 1680, in generateFortranCompilerGuesses
    raise RuntimeError('Fortran compiler you provided with --with-fc='+self.argDB['with-fc']+' cannot be found or does not work.'+'\n'+self.mesg)
================================================================================
Finishing configure run at Tue, 18 Oct 2022 00:01:31 +0200
================================================================================

```

---

<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:** [October 18, 2022, 6:07am UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/4 "2022-10-18T06:07:40Z")

</div>

You are still trying to build PETSc 3.17.0, which means you are not tracking an up-to-date FreeFEM `develop` branch. Please restart from scratch.

---

<div class="post-metadata">

**Author:** ![byb](https://avatars.discourse-cdn.com/v4/letter/b/71e660/32.png) [@byb](https://community.freefem.org/u/byb)\
**Post date:** [October 19, 2022, 1:28pm UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/5 "2022-10-19T13:28:30Z")

</div>

Hi prj,

I downloded the develop branch from this link: [https://github.com/FreeFem/FreeFem-sources/tree/develop](https://github.com/FreeFem/FreeFem-sources/tree/develop)

I am still getting the same error message :

```auto
=============================================================================================
                         Configuring PETSc to compile on your system
=============================================================================================
TESTING: checkFortranCompiler from config.setCompilers(config/BuildSystem/config/setCompilers.py:1824) *******************************************************************************
         UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
-------------------------------------------------------------------------------
Fortran compiler you provided with --with-fc=gfortran cannot be found or does not work.
Cannot compile/link FC with gfortran.
*******************************************************************************

make: *** [petsc-3.18.0/tag-conf-real] Error 1

```

Here is a section of : 3rdparty/ff-petsc/petsc-3.18.0/configure.log

````auto
618 Executing: gfortran -c -o /tmp/petsc-8jrxzd2j/config.setCompilers/conftest.o -I/tmp/petsc-8jrxzd2j/config.setCompilers /tmp/petsc-8jrxzd2j/config.setCompilers/conftest.F90
619 Successful compile:
620 Source:
621 program main
622
623 end
624
625 Executing: gfortran -o /tmp/petsc-8jrxzd2j/config.setCompilers/conftest /tmp/petsc-8jrxzd2j/config.setCompilers/conftest.o
626 Possible ERROR while running linker: exit code 1
627 stderr:
628 ld: library not found for -lSystem
629 collect2: error: ld returned 1 exit status
630 Linker output before filtering:
631
632 ld: library not found for -lSystem
633 collect2: error: ld returned 1 exit status
634 :
635 Linker output after filtering:
636 ld: library not found for -lSystem
637 collect2: error: ld returned 1 exit status:
638 Error testing Fortran compiler: Cannot compile/link FC with gfortran.
639 MPI compiler wrapper gfortran is likely incorrect.
640 Use --with-mpi-dir to indicate an alternate MPI.
641 Deleting "FC"
642 *******************************************************************************
643 UNABLE to CONFIGURE with GIVEN OPTIONS (see configure.log for details):
644 -------------------------------------------------------------------------------
645 Fortran compiler you provided with --with-fc=gfortran cannot be found or does not work.
646 Cannot compile/link FC with gfortran.
647 *******************************************************************************
648 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/configure.py", line 461, in petsc_configure
649 framework.configure(out = sys.stdout)
650 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/framework.py", line 1409, in configure
651 self.processChildren()
652 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/framework.py", line 1397, in processChildren
653 self.serialEvaluation(self.childGraph)
654 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/framework.py", line 1372, in serialEvaluation
655 child.configure()
656 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/setCompilers.py", line 2741, in configure
657 self.executeTest(self.checkFortranCompiler)
658 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/base.py", line 138, in executeTest
659 ret = test(*args,**kargs)
660 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/setCompilers.py", line 1831, in checkFortranCompiler
661 for compiler in self.generateFortranCompilerGuesses():
662 File "/Users/yacine/Desktop/FreeFem-sources-develop/3rdparty/ff-petsc/petsc-3.18.0/config/BuildSystem/config/setCompilers.py", line 1756, in generateFortranCompilerGuesses
663 raise RuntimeError('Fortran compiler you provided with --with-fc='+self.argDB['with-fc']+' cannot be found or does not work.'+'\n'+self.mesg)
664 ================================================================================
665 Finishing configure run at Wed, 19 Oct 2022 15:22:20 +0200
666 ================================================================================```

Thank you in advance for your time.
````

---

<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:** [October 19, 2022, 1:33pm UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/6 "2022-10-19T13:33:06Z")

</div>

Is `gfortran` installed on your machine? I would really need that file in full 😕 Can’t you upload it somewhere, e.g., WeTransfer? Or send it directly to my email address?

---

<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:** [October 19, 2022, 1:35pm UTC](https://community.freefem.org/t/freefem-installation-petsc-config-error/2065/7 "2022-10-19T13:35:18Z")

</div>

I’ve given you enough privilege on the forum so that you can now upload `configure.log`. Please do so.
