0 votes
by (480 points)

Hi,

I was trying to install OpenCarp on macOS with M3 Max chip, following the building from source instructions, while I am building using CMake, I have complied this command: "cmake -S. -B_build -DDLOPEN=ON -DBUILD_EXTERNAL=ON -DCMAKE_BUILD_TYPE=Release" without an issue, but when I am tring to complie:"cmake --build _build", I got an error:

[  1%] Built target generate_ION_IF_datatypes_h

[ 10%] Built target param

[ 12%] Built target param-bin

[ 13%] Built target carp

[ 18%] Built target numerics

[ 19%] Built target fem

[ 69%] Built target limpet

[ 71%] Built target physics

[ 73%] Built target simulator

[ 73%] Building CXX object CMakeFiles/opencarp-bin.dir/simulator/main.cc.o

gmake[2]: /usr/local/Cellar/llvm/5.0.1/bin/clang++: No such file or directory

gmake[2]: *** [CMakeFiles/opencarp-bin.dir/build.make:79: CMakeFiles/opencarp-bin.dir/simulator/main.cc.o] Error 127

gmake[1]: *** [CMakeFiles/Makefile2:398: CMakeFiles/opencarp-bin.dir/all] Error 2

gmake: *** [Makefile:156: all] Error 2

I have installed Clang++, which is located at "/opt/homebrew/opt/llvm/bin/clang++". I tried to add this to the PATH, and also tried to replace the location in "CMakeFiles/opencarp-bin.dir/build.make" file, but neither one worked. Could someone help me with this issue?

Thank you so much

1 Answer

0 votes
by (620 points)

Hey, 

it seems like your cmake tries to access clang with an old (non-existing) path. To my understanding, (on newer Macs at least) homebrew does not install packages in  /usr/local/Cellar/ anymore but rather in /opt/homebrew/Cellar.

Try the following to let cmake make use of the llvm installed by homebrew:

# Set standard C compilers

export CC=clang

export CXX=clang++

# Set LLVM ENVs

export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"

export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"

# Update PATH env

PATH=/opt/homebrew/bin:$PATH

PATH=/opt/homebrew/opt/llvm/bin:$PATH

export PATH

Hope this helps! 

by (620 points)

Don't forget to clear the cmake cache by deleting CMakeCache.txt CMakeFiles in your build directory and reconfigure using 

cmake -S. -B_build -DDLOPEN=ON -DBUILD_EXTERNAL=ON -DCMAKE_BUILD_TYPE=Release

PS: if you are using the preinstalled python version of MacOS and it is still python 3.9, you might run into problems with building the external tools. If that seems to be the case, build with -DBUILD_EXTERNAL=OFF first and see if openCARP compiles correctly. With more recent python versions it should not create problems.

Welcome to openCARP Q&A. Ask questions and receive answers from other members of the community. For best support, please use appropriate TAGS!
architecture, carputils, documentation, experiments, installation-containers-packages, limpet, slimfem, website, governance
...