Installation error from source with MacOS M3 Pro

Hi everyone!

I am having some difficulties installing openMC from source. I am following all the steps from the installation guide, but it seems I am having an error with the CXX complier when running "cmake . . "

this is the error that I am getting.

– The C compiler identification is AppleClang 15.0.0.15000309
– The CXX compiler identification is Clang 18.1.8
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - failed
– Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++
– Check for working CXX compiler: /opt/homebrew/opt/llvm/bin/clang++ - broken
CMake Error at /opt/homebrew/Cellar/cmake/3.30.3/share/cmake/Modules/CMakeTestCXXCompiler.cmake:73 (message):
The C++ compiler

"/opt/homebrew/opt/llvm/bin/clang++"

is not able to compile a simple test program.

It fails with the following output:

Change Dir: '/Users/eiriniklemes/openmc/CMakeFiles/CMakeScratch/TryCompile-LhGtlS'

Run Build Command(s): /opt/homebrew/Cellar/cmake/3.30.3/bin/cmake -E env VERBOSE=1 /usr/bin/make -f Makefile cmTC_498e8/fast
/Library/Developer/CommandLineTools/usr/bin/make  -f CMakeFiles/cmTC_498e8.dir/build.make CMakeFiles/cmTC_498e8.dir/build
Building CXX object CMakeFiles/cmTC_498e8.dir/testCXXCompiler.cxx.o
/opt/homebrew/opt/llvm/bin/clang++   -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -MD -MT CMakeFiles/cmTC_498e8.dir/testCXXCompiler.cxx.o -MF CMakeFiles/cmTC_498e8.dir/testCXXCompiler.cxx.o.d -o CMakeFiles/cmTC_498e8.dir/testCXXCompiler.cxx.o -c /Users/eiriniklemes/openmc/CMakeFiles/CMakeScratch/TryCompile-LhGtlS/testCXXCompiler.cxx
Linking CXX executable cmTC_498e8
/opt/homebrew/Cellar/cmake/3.30.3/bin/cmake -E cmake_link_script CMakeFiles/cmTC_498e8.dir/link.txt --verbose=1
/opt/homebrew/opt/llvm/bin/clang++  -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/homebrew/Cellar/qt/6.3.1_1/lib  CMakeFiles/cmTC_498e8.dir/testCXXCompiler.cxx.o -o cmTC_498e8
ld: warning: directory not found for option '-L/opt/homebrew/Cellar/qt/6.3.1_1/lib'
ld: unsupported tapi file type '!tapi-tbd' in YAML file '/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk/usr/lib/libc++.tbd' for architecture arm64
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [cmTC_498e8] Error 1
make: *** [cmTC_498e8/fast] Error 2

CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:2 (project)

– Configuring incomplete, errors occurred!

Hi @tklemes

Instead of the export CXX=/opt/homebrew/opt/llvm/bin/clang++ command listed on the openmc docs, try this:

export CC=/usr/local/opt/llvm/bin/clang
export CXX=/usr/local/opt/llvm/bin/clang++
export LDFLAGS="-L/usr/local/opt/llvm/lib"
export CPPFLAGS="-I/usr/local/opt/llvm/include"

Make sure your build directory is empty. You can do rm -rf * to remove all contents inside build, then run cmake .. again.

I hope this helps.