You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug in the OLD implementation in CMake 3.22.1 is causing SPIR-V Tools test code to compile with tailing -std=c++11 when it really needs -std=c++17 to take effect.
A fix is
cmake_policy(SET CMP0128 NEW)
The bug is fixed in CMake 3.22.2
When the bug is present, I get a build.ninja lines like this:
When I set the policy to NEW, and in 3.22.2 and later, I get a configuration line like this for one particular object compilation. I have bolded the operative parts, which is at the end of the FLAGS line.
I found this when building the Android NDK with updated sources for Shaderc and SPIRV-Tools.
The Android NDK uses a prebuild of CMake 3.22.1. Neither Shaderc or SPIRV-Tools sets the CMP0128 policy, so by default it gets the old behaviour, and the bug appears. This prevents building, and in particular prevents updates of shader-tools in the NDK.
Work around a problem in CMake 3.22.1 in setting -std=c++17.
Instead -std=c++11 is in effect for targets in test/*, but those targets require C++17.
Fixes compiling SPIRV-Tools test targets in with certain Clang
and CMake combinations. Fixes a problem when trying to refresh
shader-tools in the Android NDK.
Fixes: google#1350
This bug in the OLD implementation in CMake 3.22.1 is causing SPIR-V Tools test code to compile with tailing -std=c++11 when it really needs -std=c++17 to take effect.
A fix is
cmake_policy(SET CMP0128 NEW)
The bug is fixed in CMake 3.22.2
When the bug is present, I get a build.ninja lines like this:
build third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir/binary_destroy_test.cpp.o: CXX_COMPILER__test_spirv_unit_tests_Release /build/ndk/external/shaderc/spirv-tools/test/binary_destroy_test.cpp || cmake_object_order_depends_target_test_spirv_unit_tests
DEFINES = -DSPIRV_COLOR_TERMINAL -DSPIRV_LINUX -DSPIRV_TIMER_ENABLED
DEP_FILE = third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir/binary_destroy_test.cpp.o.d
FLAGS = --target=x86_64-linux-gnu --sysroot=/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -L/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -B/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64 -B/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64 -L/project/ndk/prebuilts/clang/host/linux-x86/clang-r498229/lib64 -B/project/ndk/prebuilts/clang/host/linux-x86/clang-r498229/lib64 -Os -fomit-frame-pointer -s -fuse-ld=lld -Wno-unused-command-line-argument -fno-rtti -fno-exceptions -stdlib=libc++ -Wimplicit-fallthrough -O3 -DNDEBUG -fPIE -Wextra-semi -w -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-self-assign -Werror -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion -fno-exceptions -ftemplate-depth=1024 -Wno-undef -Wno-shadow -std=c++11 -pthread
INCLUDES = -I/build/ndk/external/shaderc/spirv-tools -I/project/ndk/external/shaderc/spirv-headers/include -I/build/ndk/external/shaderc/spirv-tools/include -I/build/ndk/external/shaderc/spirv-tools/test -I/build/ndk/out/linux/shader-tools/build/third_party/spirv-tools -I/build/ndk/external/effcee -I/build/ndk/external/effcee/effcee/.. -I/build/ndk/external/regex-re2 -isystem /build/ndk/external/googletest/googletest/include -isystem /build/ndk/external/googletest/googlemock/include -isystem /build/ndk/external/googletest/googlemock -isystem /build/ndk/external/googletest/googletest
OBJECT_DIR = third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir
OBJECT_FILE_DIR = third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir
When I set the policy to NEW, and in 3.22.2 and later, I get a configuration line like this for one particular object compilation. I have bolded the operative parts, which is at the end of the FLAGS line.
build third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir/binary_destroy_test.cpp.o: CXX_COMPILER__test_spirv_unit_tests_Release /build/ndk/external/shaderc/spirv-tools/test/binary_destroy_test.cpp || cmake_object_order_depends_target_test_spirv_unit_tests
DEFINES = -DSPIRV_COLOR_TERMINAL -DSPIRV_LINUX -DSPIRV_TIMER_ENABLED
DEP_FILE = third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir/binary_destroy_test.cpp.o.d
FLAGS = --target=x86_64-linux-gnu --sysroot=/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -L/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -B/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64 -B/project/ndk/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64 -L/project/ndk/prebuilts/clang/host/linux-x86/clang-r498229/lib64 -B/project/ndk/prebuilts/clang/host/linux-x86/clang-r498229/lib64 -Os -fomit-frame-pointer -s -fuse-ld=lld -Wno-unused-command-line-argument -fno-rtti -fno-exceptions -stdlib=libc++ -Wimplicit-fallthrough -O3 -DNDEBUG -fPIE -Wextra-semi -w -Wall -Wextra -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-self-assign -Werror -Wno-long-long -Wshadow -Wundef -Wconversion -Wno-sign-conversion -fno-exceptions -ftemplate-depth=1024 -Wno-undef -Wno-shadow -std=c++11 -pthread -std=c++17
INCLUDES = -I/build/ndk/external/shaderc/spirv-tools -I/project/ndk/external/shaderc/spirv-headers/include -I/build/ndk/external/shaderc/spirv-tools/include -I/build/ndk/external/shaderc/spirv-tools/test -I/build/ndk/out/linux/shader-tools/build/third_party/spirv-tools -I/build/ndk/external/effcee -I/build/ndk/external/effcee/effcee/.. -I/build/ndk/external/regex-re2 -isystem /build/ndk/external/googletest/googletest/include -isystem /build/ndk/external/googletest/googlemock/include -isystem /build/ndk/external/googletest/googlemock -isystem /build/ndk/external/googletest/googletest
OBJECT_DIR = third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir
OBJECT_FILE_DIR = third_party/spirv-tools/test/CMakeFiles/test_spirv_unit_tests.dir
The correct compilation has the -std=c++17 option which is required for the target.
The text was updated successfully, but these errors were encountered: