Home > OS >  Mac OSX 12.4 (Monterey). Trying to compile an old Python code. Configure: error: set PETSC_DIR to po
Mac OSX 12.4 (Monterey). Trying to compile an old Python code. Configure: error: set PETSC_DIR to po

Time:07-22

I have been trying to compile an old Python code. A couple of days ago I posted a question that described problems with accessing Python and gfortran. I solved the Python problem, then the question no longer made sense. It had no answers so I deleted it. However, now when I run a "configure" script, I'm getting an error that I don't understand:

configure: error: You need to set PETSC_DIR to point at your PETSc installation... exiting 

An online search to find out what PETSc is turned up a forum post (https://github.com/firedrakeproject/firedrake/issues/1703) that mentions "gfortran" and I wonder that's where my problem is. I installed gcc via Homebrew to get gfortran and now see it at /usr/local/bin/gfortran. In my .zshrc file, I added:

export PATH=$PATH:/usr/local/bin
alias python=/usr/local/bin/gfortran

When I do:

gfortran --version

I get (which seems fine):

GNU Fortran (Homebrew GCC 11.3.0_2) 11.3.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

When I do:

which gfortran 

I get the following.

aliased to gfortran -L/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib

The other thing that seems relevant is that I just did:

brew install openmpi

to overcome an error related to not having MPI. I don't know anything about using MPI on a Mac so it's likely this is where I'm going wrong.

configure: error: no MPI support found on system

Here are the clues from the "configure" script log file:

checking for malloc in -ltcmalloc... no
configure: WARNING: No tcmalloc support available.
checking for mpif90... no
checking for mpf90... no
checking for mpicc... no
checking for mpcc... no
checking for mpicxx... no
checking for mpiCC... no
checking for mpCC... no
checking if we can compile and link without using -lmpi... no
checking if we can compile and link using -lmpi... no
checking if we can compile and link using mpich libs... no
configure: error: no MPI support found on system

I would be very grateful if someone could please point me in the right direction.

CodePudding user response:

Your error message indicates that the PETSc library is missing. You can probably find a pip installation that gives you petsc with a python interface.

However, your further problem with Zoltan indicates that (probably) you need a petsc installation that has zoltan as optional package. I'm not sure that you can find a pip install for that. You may need to install petsc entirely by hand.

https://petsc.org/release/install/

and use the configuration options --with-zoltan --with-mpi4py.

  • Related