In general, follow the build instructions: https://opencarp.org/download/installation#building-from-source
Homebrew works on M1 machines, however the packages are not installed in /usr/local but /opt/homebrew. It is not recommended to change that (and my attempts to do so were not successful).
- The resulting non-standard paths require some environment variables to be set:
- export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
- export HDF5_DIR=/opt/homebrew
- export PATH="/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew/opt/llvm/bin:$PATH"
- export BLAS=/opt/homebrew/Cellar/lapack/3.9.0_1/lib/libblas.dylib
- export LAPACK=/opt/homebrew/Cellar/lapack/3.9.0_1/lib/liblapack.dylib
- Make sure to install libjpeg, c-blosc, llvm and email@example.com from homebrew. Some of the carputils dependencies (e.g. tables) do not yet work properly with Python 3.9 as of now. However, homebrew also requires Python 3.9. Thus, you'll need both versions installed. To use 3.8 by default, run
- brew install firstname.lastname@example.org
- brew unlink email@example.com
- brew link firstname.lastname@example.org
- Make sure the directory /usr/local/bin exists
The hardest part was to get all python dependencies installed. The following worked for me:
Then, remove the version specifications from carputils/requirements.py3.txt for numpy, pandas and scipy. After that, pip3 install --user -r requirements.txt should run fine.
When compiling meshtool, you also need to provide the non-standard path for libomp:
- In openCARP/_build/external/meshtool/src/meshtool/switches.def, add -L/opt/homebrew/opt/llvm/lib to the end of line 26. In openCARP/_build/external/meshtool/src/meshtool/my_switches.def, make sure to use clang as compiler
Meshalyzer compiled without problems using the CMake workflow.