Can't build the OpenMC correctly

Dear all,
I’m now trying to install OpenMC from source but having some issues with xtensor. When I compile OpenMC with cmake, there is always an error about xtensor. The error message is listed below:

-- The C compiler identification is GNU 5.5.0
-- The CXX compiler identification is GNU 5.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Did not find fmt, will use submodule instead
-- Did not find pugixml, will use submodule instead
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.8") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.2.54") 
-- Found HDF5: /usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5_hl.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/lib/libhdf5.so;/usr/lib/x86_64-linux-gnu/libpthread.so;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.so;/usr/lib/x86_64-linux-gnu/libm.so (found version "1.8.16") 
-- Try OpenMP C flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Try OpenMP CXX flag = [-fopenmp]
-- Performing Test OpenMP_FLAG_DETECTED
-- Performing Test OpenMP_FLAG_DETECTED - Success
-- Found OpenMP: -fopenmp  
-- OpenMC C++ flags: -fopenmp;-O2
-- OpenMC Linker flags: -fopenmp
-- Found Git: /usr/bin/git (found version "2.7.4") 
-- Submodule update
You have called ADD_LIBRARY for library pugixml without any source files. This typically indicates a problem with your CMakeLists.txt file
You have called ADD_LIBRARY for library pugixml-shared without any source files. This typically indicates a problem with your CMakeLists.txt file
You have called ADD_LIBRARY for library pugixml-static without any source files. This typically indicates a problem with your CMakeLists.txt file
-- Module support is disabled.
-- Version: 8.0.1
-- Build type: 
-- CXX_STANDARD: 11
-- Performing Test has_std_11_flag
-- Performing Test has_std_11_flag - Success
-- Performing Test has_std_0x_flag
-- Performing Test has_std_0x_flag - Success
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS
-- Performing Test SUPPORTS_USER_DEFINED_LITERALS - Success
-- Performing Test FMT_HAS_VARIANT
-- Performing Test FMT_HAS_VARIANT - Failed
-- Required features: cxx_variadic_templates
-- Looking for strtod_l
-- Looking for strtod_l - not found
-- xtl v0.6.13
-- Building xtensor v0.21.3
CMake Error at vendor/xtensor/CMakeLists.txt:36 (if):
  if given arguments:

    "NOT" "0.6.13" "VERSION_GREATER_EQUAL" "0.6.9"

  Unknown arguments specified


-- Configuring incomplete, errors occurred!
See also "/home/yzy/openmc/build/CMakeFiles/CMakeOutput.log".
See also "/home/yzy/openmc/build/CMakeFiles/CMakeError.log".


The reason I use this way of installation is that I have to configure OpenMPI for my OpenMC. During the installation process, I completely followed the official tutorial. I really want to know how to solve this problem. Any suggesstions would be appreciated.

Yours Sincerely

Perhaps we should look into adding a build of openmc with OpenMPI into the Conda distribution

it looks like the version of Xtensor you have is not quite new enough. I thought that the right version was brought in via the git clone (recursive submodules) but perhaps you have a preexisting version of Xtensor already installed

We using version 0.6.13 in the conda install openmc-feedstock/meta.yaml at b128b60e24855b5b49fce05af7f5482f78f43479 · conda-forge/openmc-feedstock · GitHub

Not sure if this is helpful as it might not be the OS you are using but I have an install from source script here.

The Dockerfile also contains some build instructions that might be useful.

1 Like

To me, it looks as though CMake is complaining that one of the arguments to the if-statement isn’t valid. The versions of xtensor reported by CMake in the error output here look like they would satisfy the version requirements. All of the arguments that it’s showing here look valid to me, however.

I recall that some of CMake’s version comparison statements were added later than others. VERSION_GREATER_EQUAL wasn’t supported until CMake 3.7 for instance. @Zhiying, is it possible that your CMake version is older than this?

1 Like

Thanks a lot for your suggestions. I checked the version of cmake and found that the version of cmake installed on my computer is 3.5. I will reinstall cmake and report the results of the installation here, thanks again for your help.

Yours Sincerely

1 Like

This actually should have been caught by xtensor’s CMakeLists.txt file but they incorrectly listed a minimum version of 3.1. I’ve filed a bug with xtensor so once they get it fixed, we can pull in a new version and avoid this in the future.

1 Like

After I updated my CMake, gcc, and g++, OpenMC has been able to run successfully on my computer. I am using ubuntu16.04. The reason for the previous configuration error is that the default versions of CMake, GCC, and g++ are installed on my computer. In addition, in order to avoid the defects of C++14 during installation, I installed GCC-7 and g+±7. Thanks a lot for everyone’s help.

Yours sincerely!

This is a great example of some nice feedback and targeted bugs squashing that makes the software work better for everyone. Great to see :clap: