xtl icon indicating copy to clipboard operation
xtl copied to clipboard

Compilation error in MacOS: no member named 'terminate' in namespace 'std'; did you mean 'template'?

Open amwink opened this issue 6 months ago • 1 comments

I'm installing XTL on MacOS, building the tests as well. During this build I get the error:

In file included from /Users/amwink/software/cpp/bispackage/dep/xtensor-stack/xtl/test/test_xhalf_float.cpp:17:
In file included from /Users/amwink/software/cpp/bispackage/dep/xtensor-stack/xtl/include/xtl/xhalf_float.hpp:14:
/Users/amwink/software/cpp/bispackage/dep/xtensor-stack/xtl/include/xtl/xhalf_float_impl.hpp:4022:8: error: no member named 'terminate' in namespace 'std'; did you mean 'template'?
 4022 |                 std::terminate();
      |                 ~~~~~^~~~~~~~~
      |                      template
/Users/amwink/software/cpp/bispackage/dep/xtensor-stack/xtl/include/xtl/xhalf_float_impl.hpp:4022:17: error: expected unqualified-id
 4022 |                 std::terminate();
      |                               ^
2 warnings and 2 errors generated.
make[2]: *** [test/CMakeFiles/test_xtl.dir/test_xhalf_float.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/test_xtl.dir/all] Error 2
make: *** [all] Error 2
Building of project xtl did not succeed - exiting now

I use the same install script as I did in Linux, where it compiled without errors. Does MacOS(clang) require different setup options than Linux(gcc)?

amwink avatar Jul 21 '25 12:07 amwink

I think we're missing some include (std::terminate is defined in the header <exception>, which is not included in xhalf_float_impl.hpp. We may be more lucky on Linux where it is probably included by other headers. Adding the missing include to xhalf_float_impl.hpp should probably fix your issue, although I'm a bit surprised we did not catch it in the CI.

JohanMabille avatar Oct 14 '25 20:10 JohanMabille