Skip to content

Compiler error with CMAKE_CXX_COMPILE_FEATURES

Summary

This statement in cmake breaks DPCPP as it partially supports c++20 features, not all of them. Dpcpp uses the latest clang version and some c++20 features, but not all, hence it reports cxx_std_20 in the list of CMAKE_CXX_COMPILE_FEATURES, but breaks as it cannot find the std::construct_at function. Since the CMAKE_CXX_COMPILE_FEATURES flag override the user-specified compiler c++ standard, any compiler that partially supports some C++ features will break with this change. I think the value set for CMAKE_CXX_STANDARD by user would be a better check here, or this if statement has to be manually disabled for compiler that does not support all C++-20 features.

Environment

  • Operating System : Windows/Linux
  • Architecture : x64/Arm64/PowerPC ...
  • Eigen Version : 3.3.9
  • Compiler Version : Gcc7.0
  • Compile Flags : -O3 -march=native
  • Vector Extension : SSE/AVX/NEON ...

Minimal Example

//show your code here

Steps to reproduce

The error can be found here: https://my.cdash.org/viewBuildError.php?buildid=2260323

To reconstruct this error:

  1. download dpcpp from here: https://github.com/intel/llvm/releases/tag/sycl-nightly%2F20221215
  2. build sycl dpcpp backend using this branchas follow:
export CC=/path/to/dpcpp_compiler/bin/clang
export CXX/path/to/dpcpp_compiler/bin/clang++ 
export LD_library_path=path/to/dpcpp_compiler/lib/
cmake .. -DEIGEN_TEST_SYCL=1 -DEIGEN_SYCL_DPCPP=ON -DCMAKE_BUILD_TYPE=Release -DDPCPP_SYCL_TARGET="spir64" -DSITE="your-site-name" -DEIGEN_TEST_BUILD_DOCUMENTATION=1 -DEIGEN_INTERNAL_DOCUMENTATION=1 -GNinja 
ctest --build-clean -C Release -D Experimental

What is the current bug behavior?

What is the expected correct behavior?

Relevant logs

Warning Messages

Benchmark scripts and results

Anything else that might help

  • Have a plan to fix this issue.
Edited by Mehdi Goli