Build error, errors in vendor/Catch2

Hello, everyone!
I am at a loss. I cannot build OpenMC from source, because of some error during make. Errors occur in vendor/Catch2/src/catch2/…/catch2/catch_test_case_info.hpp.
I will post part of make output below. If I am missing something, please, point me to relevant documentation.

[ 63%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/interfaces/catch_interfaces_testcase.cpp.o
[ 64%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_approx.cpp.o
[ 64%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_assertion_result.cpp.o
[ 65%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_config.cpp.o
[ 65%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_get_random_seed.cpp.o
[ 66%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_message.cpp.o
[ 66%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_registry_hub.cpp.o
[ 67%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_session.cpp.o
[ 67%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_tag_alias_autoregistrar.cpp.o
[ 68%] Building CXX object vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_test_case_info.cpp.o
In file included from /home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:8:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/catch_test_case_info.hpp:47:10: warning: elaborated-type-specifier for a scoped enum must not use the ‘class’ keyword
47 | enum class TestCaseProperties : uint8_t {
| ~~~~ ^~~~~
| -----
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/catch_test_case_info.hpp:47:35: error: found ‘:’ in nested-name-specifier, expected ‘::’
47 | enum class TestCaseProperties : uint8_t {
| ^
| ::
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/catch_test_case_info.hpp:47:16: error: ‘TestCaseProperties’ has not been declared
47 | enum class TestCaseProperties : uint8_t {
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/catch_test_case_info.hpp:47:45: error: expected unqualified-id before ‘{’ token
47 | enum class TestCaseProperties : uint8_t {
| ^
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/catch_test_case_info.hpp:97:9: error: ‘TestCaseProperties’ does not name a type
97 | TestCaseProperties properties = TestCaseProperties::None;
| ^~~~~~~~~~~~~~~~~~
In file included from /home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:10:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/internal/catch_string_manip.hpp:47:14: error: ‘uint64_t’ in namespace ‘std’ does not name a type; did you mean ‘wint_t’?
47 | std::uint64_t m_count;
| ^~~~~~~~
| wint_t
/home/alx8kv/openmc/vendor/Catch2/src/catch2/…/catch2/internal/catch_string_manip.hpp:51:42: error: expected ‘)’ before ‘count’
51 | constexpr pluralise(std::uint64_t count, StringRef label):
| ~ ^~~~~~
| )
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:20:37: error: ‘uint8_t’ does not name a type
20 | using TCP_underlying_type = uint8_t;
| ^~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:16:1: note: ‘uint8_t’ is defined in header ‘’; did you forget to ‘#include ’?
15 | #include
+++ |+#include
16 |
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:21:30: error: ‘TestCaseProperties’ was not declared in this scope
21 | static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:21:60: error: ‘TCP_underlying_type’ was not declared in this scope; did you mean ‘__underlying_type’?
21 | static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),
| ^~~~~~~~~~~~~~~~~~~
| __underlying_type
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:24:9: error: ‘TestCaseProperties’ does not name a type
24 | TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:30:9: error: ‘TestCaseProperties’ does not name a type
30 | TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:37:9: error: ‘TestCaseProperties’ does not name a type
37 | TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:43:22: error: ‘TestCaseProperties’ was not declared in this scope
43 | bool applies(TestCaseProperties tcp) {
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:49:9: error: ‘TestCaseProperties’ does not name a type
49 | TestCaseProperties parseSpecialTag( StringRef tag ) {
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp: In function ‘bool Catch::{anonymous}::isReservedTag(Catch::StringRef)’:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:66:20: error: ‘parseSpecialTag’ was not declared in this scope
66 | return parseSpecialTag( tag ) == TestCaseProperties::None
| ^~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:66:46: error: ‘TestCaseProperties’ has not been declared
66 | return parseSpecialTag( tag ) == TestCaseProperties::None
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp: In constructor ‘Catch::TestCaseInfo::TestCaseInf (Catch::StringRef, const Catch::NameAndTags&, const Catch::SourceLineInfo&)’:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:158:17: error: ‘properties’ was not declared in this scope
158 | properties |= parseSpecialTag(tagStr);
| ^~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:158:31: error: ‘parseSpecialTag’ was not declared in this scope
158 | properties |= parseSpecialTag(tagStr);
| ^~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp: In member function ‘bool Catch::TestCaseInfo::isHidden() const’:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:184:25: error: ‘properties’ was not declared in this scope
184 | return applies( properties & TestCaseProperties::IsHidden );
| ^~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:184:38: error: ‘TestCaseProperties’ has not been declared
184 | return applies( properties & TestCaseProperties::IsHidden );
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:184:67: error: ‘Catch::{anonymous}::applies’ cannot be used as a function
184 | return applies( properties & TestCaseProperties::IsHidden );
| ^
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp: In member function ‘bool Catch::TestCaseInfo::throws() const’:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:187:25: error: ‘properties’ was not declared in this scope
187 | return applies( properties & TestCaseProperties::Throws );
| ^~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:187:38: error: ‘TestCaseProperties’ has not been declared
187 | return applies( properties & TestCaseProperties::Throws );
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:187:65: error: ‘Catch::{anonymous}::applies’ cannot be used as a function
187 | return applies( properties & TestCaseProperties::Throws );
| ^
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp: In member function ‘bool Catch::TestCaseInfo::okToFail() const’:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:190:25: error: ‘properties’ was not declared in this scope
190 | return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
| ^~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:190:39: error: ‘TestCaseProperties’ has not been declared
190 | return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:190:72: error: ‘TestCaseProperties’ has not been declared
190 | return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:190:102: error: ‘Catch::{anonymous}::applies’ cannot be used as a function
190 | return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );
| ^
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp: In member function ‘bool Catch::TestCaseInfo::expectedToFail() const’:
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:193:25: error: ‘properties’ was not declared in this scope
193 | return applies( properties & (TestCaseProperties::ShouldFail) );
| ^~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:193:39: error: ‘TestCaseProperties’ has not been declared
193 | return applies( properties & (TestCaseProperties::ShouldFail) );
| ^~~~~~~~~~~~~~~~~~
/home/alx8kv/openmc/vendor/Catch2/src/catch2/catch_test_case_info.cpp:193:71: error: ‘Catch::{anonymous}::applies’ cannot be used as a function
193 | return applies( properties & (TestCaseProperties::ShouldFail) );
| ^
make[2]: *** [vendor/Catch2/src/CMakeFiles/Catch2.dir/build.make:622: vendor/Catch2/src/CMakeFiles/Catch2.dir/catch2/catch_test_case_info.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:945: vendor/Catch2/src/CMakeFiles/Catch2.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

@alx8kv welcome to the community! Sorry to hear you’ve run into some compilation errors. What OS are you on? And what compiler are you using?

@paulromano, I use WSL with Arch in it. The compiler is g++ (GCC) v13.1.1 20230429, I believe.

It looks like this is an issue in Catch2, which we use in OpenMC for unit tests. As a quick workaround, you can try building with tests disabled:

cmake -DOPENMC_BUILD_TESTS=off ..

@paulromano Thank you! This worked, build complete successfully. But now I can’t plot anything with error:
“Your version of OpenMC may not be built against libpng”. But I definitely have libpng installed.

Hmm, that’s strange. I was going to ask whether you have the libpng header files installed, but it looks like the libpng package on arch does include header files. If you know where libpng.h is, you may want to try calling cmake -DPNG_ROOT=<dir> ... and see if that helps CMake figure it out.

@paulromano So. I have switched my WSL from Arch to Debian, to have fully clean OS.
I have also built all dependencies from sources, including libpng. OpenMC did all its compiling with no errors, not even Catch2, but when trying to call plot_inline I am once again greeted by libpng error.
I have used following cmake command to build the program:
cmake -DOPENMC_ENABLE_PROFILE=on -DOPENMC_USE_NCRYSTAL=on -DOPENMC_USE_MCPL=on -DOPENMC_USE_MPI=on -DOPENMC_USE_DAGMC=on -DCMAKE_PREFIX_PATH=$DAGMC_DIR -DHDF5_PREFER_PARALLEL=on -DPNG_ROOT=$LIBPNG_DIR -DCMAKE_INSTALL_PREFIX=$HOME/.local/openmc/ ..

UPD: openmc.plot_inline() seems to work with non-CAD geometries. But with dagmc.h5m from “Using CAD-Based Geometries” no plotting seems possible: no .png files are produced, and nothing can be plotted inline.

Glad to hear you got it working for non-CAD geometries. On Debian derivatives, the libpng-dev package should work fine so there should be no need to build libpng from source. I don’t see why that would be an issue for the CAD geometries but could be worth a shot? In general though, CAD stuff is out of my domain so hoping others might chime in.

Yeah, that’s the thing… I’ve tried it both with libpng-dev and built-from-source. Still doesn’t work. Anyway, thanks for your help!

I was able to run openmc in a docker container correctly.
I ditched the WSL altogether, installed openmc/openmc:develop-dagmc docker container, and the CAD geometry was finally plotted. Inside latest-dagmc the simulation runs correctly, but plotting is still available only for non-CAD geometries.
Getting openmc-plotter to work required jumping through additional hoops: installing qtbase5-dev, installing openmc-plotter and then committing changes to the image.