Tutorial for a fully working GetFEM installation on MacOS systems

I thought to write down a complete tutorial for Apple users to get a fully working GetFEM installation on their machines. The following turns out to work well, in particular, on an Apple Silicon machine, where the default Homebrew directory is /opt/homebrew, unlike Intel machines. It is also worth to mention that the GCC 14 compiler is required (install by brew install gcc in case it’s missing).

So, in addition to the procedure described here for qhull, m4, automake, the Python packages, etc., starting from GetFEM 5.4.3, neither SuperLU nor MUMPS ship with the GetFEM distribution.

To install SuperLU, run

brew install superlu

In theory, SuperLU should suffice, but in practice, with just SuperLU, the installation of GetFEM you obtain will only be “partial”.

Hence, I would suggest to additionally install MUMPS, by first running

brew tap brewsci/num

Then, before installing MUMPS (5.3.5 is the only one I was able to install, so far), go to the following directory

/opt/homebrew/Library/Taps/brewsci/homebrew-num/Formula

Now, two files have to be modified: brewsci-metis.rb and brewsci-mumps.rb.

In brewsci-metis.rb, change the url and the sha256 line as follows:

url "http://deb.debian.org/debian/pool/main/m/metis/metis_5.1.0.dfsg.orig.tar.xz"
sha256 "c50a88b92b01fa3972c5c92cf50117f126c62589b8f793657c7d865c59c23615"

In brewsci-mumps.rb, change the url and the sha256 line as follows:

url "https://ftp.mcs.anl.gov/pub/petsc/externalpackages/MUMPS_5.3.5.tar.gz"
sha256 "9cf89fcb5232560e807b7b1cc2adb7d0c280cbdfd3aa480de1d0b431a87187d3"

then comment the line

noall_load = OS.mac? ? "-noall_load" : "--no-whole-archive"

and remove all occurrencies of "-Wl,#{noall_load}", in the file.

At this stage, you can run (for the sequential MUMPS)

brew install brewsci-mumps –without-mpi

After all this, you can run the configure script for GetFEM as follows (assuming your Homebrew is in /opt/homebrew, which is the case for Apple Silicon machines):

./configure CXX=g++-14 CC='gcc-14 -arch arm64 -ld_classic' CXXFLAGS='-arch arm64 
-ld_classic -no-pie -I/opt/homebrew/Cellar/qhull/2020.2/include 
-I/opt/homebrew/opt/brewsci-mumps/include' FC='gfortran-14 -arch arm64 
-ld_classic' CXXCPP='g++-14 -E -arch arm64 -ld_classic' CPP='g++-14 -E 
-arch arm64 -ld_classic'  --enable-metis --enable-python --enable-matlab=no 
--enable-shared --disable-dependency-tracking --prefix=/opt/homebrew/ --enable-superlu
LDFLAGS='-L/opt/homebrew/Cellar/superlu/7.0.0/lib -L/opt/homebrew/Cellar/qhull/2020.2/lib
-L/opt/homebrew/opt/brewsci-mumps/lib' --with-superlu-include-dir=/opt/homebrew/Cellar/
superlu/7.0.0/include --enable-mumps --with-mumps='-lsmumps -ldmumps -lcmumps
-lzmumps -lpord -lmpiseq' --with-mumps-include-dir=/opt/homebrew/opt/brewsci-mumps/include
LIBS='-lmumps_common -lpord -lmpiseq'

You can perhaps remove the option -arch arm64 on Intel machines.

At this stage, you can run

make

and finally

make install

to install GetFEM, as described here.

As a last step, to make sure your installation is sound, move to the GetFEM directory and run

make check

1 Like