1

I am trying to compile https://github.com/LuisaGroup/LuisaCompute.

During make, I got

[  0%] Built target compute
[  1%] Built target EASTL
[  2%] Built target stb
[  3%] Built target glad
[ 15%] Built target glfw
[ 16%] Built target imgui
[ 17%] Built target luisa-compute-ext
[ 17%] Built target luisa-compute-ext-copy
[ 21%] Built target spdlog
[ 26%] Built target luisa-compute-core
[ 26%] Building CXX object src/vstl/CMakeFiles/luisa-compute-vstl.dir/ThreadPool.cpp.o
/home/user/3dlab/LuisaCompute/src/vstl/ThreadPool.cpp: In lambda function:
/home/user/3dlab/LuisaCompute/src/vstl/ThreadPool.cpp:22:21: error: ‘struct std::atomic_flag’ has no member named ‘test’
   22 |             enabled.test(std::memory_order_acquire) && taskList.Length() == 0) {
      |                     ^~~~
/home/user/3dlab/LuisaCompute/src/vstl/ThreadPool.cpp: In lambda function:
/home/user/3dlab/LuisaCompute/src/vstl/ThreadPool.cpp:29:24: error: ‘struct std::atomic_flag’ has no member named ‘test’
   29 |         while (enabled.test(std::memory_order_acquire)) {
      |                        ^~~~
/home/user/3dlab/LuisaCompute/src/vstl/ThreadPool.cpp: In lambda function:
/home/user/3dlab/LuisaCompute/src/vstl/ThreadPool.cpp:40:24: error: ‘struct std::atomic_flag’ has no member named ‘test’
   40 |         while (enabled.test(std::memory_order_acquire)) {
      |                        ^~~~
make[2]: *** [src/vstl/CMakeFiles/luisa-compute-vstl.dir/build.make:160: src/vstl/CMakeFiles/luisa-compute-vstl.dir/ThreadPool.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:925: src/vstl/CMakeFiles/luisa-compute-vstl.dir/all] Error 2
make: *** [Makefile:136: all] Error 2

Cppreference says there should be a member called test if c++20 is enabled, and I checked that CMakeLists.txt does specified

set(CMAKE_CXX_STANDARD 20)

What is the problem? I have both g++ (Ubuntu 10.3.0-1ubuntu1~20.04) 10.3.0 and g++-9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 installed and /usr/bin/g++ links to g++-10

ihdv
  • 1,927
  • 2
  • 13
  • 29
  • Why do you assume that your compiler fully supports C++20? – ALX23z Dec 26 '22 at 07:01
  • The `test()` member function is not supported [until gcc11](https://godbolt.org/z/aE8z7bEWo). – 康桓瑋 Dec 26 '22 at 07:04
  • 1
    @ALX23z Well, I am no expert in C++ standards and compiler support...just need to get it working. Now I see an even newer compiler is needed – ihdv Dec 26 '22 at 07:09
  • @ihdv basically, no compiler has fully implemented C++20. Aside from perhaps MSVC? Last I heard there were still problems with modules support. – ALX23z Dec 26 '22 at 07:16
  • 1
    See [C++ compiler support](https://en.cppreference.com/w/cpp/compiler_support). – heap underrun Dec 26 '22 at 08:29

0 Answers0