BUILDING COGENT ON AN M1 MAC WITH OS 12 (Monterey), using GCC from Homebrew

0. Make sure Mac Developer Tools (including Command Line Tools) and Homebrew are up to date.

I. ============== Build GCC 10.1.0

1. Install GCC-11 from Homebrew

brew install gcc

This also installs Fortran.

II. ============== Build Openmpi-4.0.1

1. Download openmpi-4.1.2  (https://www.open-mpi.org/software/ompi/v4.1/)

2.  Configure build and install

cd to openmpi’s top level directory, then:

./configure --prefix=/usr/local/openmpi CC=gcc-11 CXX=g++-11 FC=gfortran-11 F77=gfortran-11 --enable-static --disable-dlopen

make -j8 all
sudo make -j8 install 

(Note sudo would not be needed if --prefix is set to a user-accessible area.)

3. Add to system path ahead of the default PATH.  

e.g. for tcsh, in .cshrc type: setenv PATH "/usr/local/openmpi/bin:$PATH”

III. ============== Build hdf5 (hdf5-1.12.1 as of this writing)

1. Download hdf5-1.12.1 (https://www.hdfgroup.org/downloads/hdf5/source-code/)

./configure --prefix=/usr/local/hdf5 CC=mpicc FC=mpifort CXX=mpicxx --enable-parallel --enable-fortran

make -j8
sudo make install

(Note sudo would not be needed if --prefix is set to a user-accessible area.)

IV. Install zlib from Brew:

brew install zlib

V. ============== Follow standard instructions for COGENT/Chombo/Hypre build

For hypre use: ./configure CC=mpicc CXX=mpicxx --enable-maxdim=5

For Chombo make file use this file: Make.defs.OSX_Monterey_Brew for Chombo Make.defs.local.  For a Mac with an Intel chip, replace /opt/homebrew by /usr/local/homebrew in this file.