The xtensor issue in the "make" step

Hello everyone!
I am new to OpenMC and I am trying to compile it from source. Currently I am using the following:

  • M1 Macbook Pro with Sequoia 15.2
  • Cmake v. 3.31.3
  • llvm v. 19.1.6
  • xtensor v. 0.25.0
  • Any other software necessary to compile OpenMC

In the beginning I had an issue with cmake that I fixed using the following command:

CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++  LDFLAGS=-L/opt/homebrew/opt/libomp/lib cmake -DCMAKE_INSTALL_PREFIX=$HOME/Software/openmc ..

and this step passes without any errors.

After I run make the compilation fails at the first 3% for compiling with some error related to xtensor. The error is in the images below.
IMAGE 1
IMAGE 2
The last part of the error has an ID of prsRXrD. I can’t post more than 2 links.

I have consulted Google, chatGPT, and the forum but couldn’t find any solution. I have exhausted my options and I am now writing here to ask if anyone had any similar issue and how did you solve it.

Note: I am not familiar with compilers but I set this task for myself to try to learn it and understand the concepts of compilation.

Thank you in advance! If you need any additional information please let me know.

Best,
Emir

Hey, I’m pretty sure this relates to using the clang compiler. Have you tried this?

cmake -DCMAKE_CXX_FLAGS=-fno-relaxed-template-template-args ..

when running the cmake command? I had a little trouble with clang lately on my M3 mac, and this fixed the issue.

Heyy,
Thank you for the reply. I haven’t tried it before but I have now and the cmake passes but the make doesn’t (again). It still has an issue with omp.h file.

After so many time I have managed to solve an issue. This is the guide to compile an openmc on the Macbook Pro M1.

In the CMakeList.txt one first needs to add the following lines:

set(OpenMP_C_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_C_LIB_NAMES "omp")
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp")
set(OpenMP_CXX_LIB_NAMES "omp")
set(OpenMP_omp_LIBRARY "/opt/homebrew/opt/libomp/lib/libomp.dylib")

After that, the procedure is similar as in documentation:

mkdir build && cd build
CC=/opt/homebrew/opt/llvm/bin/clang CXX=/opt/homebrew/opt/llvm/bin/clang++  LDFLAGS=-L/opt/homebrew/opt/libomp/lib cmake -DCMAKE_INSTALL_PREFIX=$HOME/Software/openmc -DCMAKE_CXX_FLAGS=-fno-relaxed-template-template-args ..
make
make install

After that, the openmc executable will be in the folder that you have specified in the -DCMAKE_INSTALL_PREFIX under bin folder.

I hope I helped someone who has the same issue as me. Thank you gridley with you helpful inputs. Cheers!