Repository navigation
Closed
Labels
compilation errorCode does not compile
Milestone
Description
When building latest release v0.10.0, there is build error:
23:02:14 [ 73%] Built target list_cpu_features
23:02:14 gmake[1]: Leaving directory '/usr/src/RPM/BUILD/cpu_features-0.10.0/x86_64-alt-linux'
23:02:14 gmake[2]: Entering directory '/usr/src/RPM/BUILD/cpu_features-0.10.0/x86_64-alt-linux'
23:02:14 [ 55%] Building CXX object test/CMakeFiles/string_view_test.dir/string_view_test.cc.o
23:02:14 cd /usr/src/RPM/BUILD/cpu_features-0.10.0/x86_64-alt-linux/test && /usr/bin/c++ -DCPU_FEATURES_TEST -I/usr/src/RPM/BUILD/cpu_features-0.10.0/test/../include -pipe -frecord-gcc-switches -Wall -fdiagnostics-color=always -g -O2 -flto=auto -O2 -DNDEBUG -std=c++14 -fPIE -MD -MT test/CMakeFiles/string_view_test.dir/string_view_test.cc.o -MF CMakeFiles/string_view_test.dir/string_view_test.cc.o.d -o CMakeFiles/string_view_test.dir/string_view_test.cc.o -c /usr/src/RPM/BUILD/cpu_features-0.10.0/test/string_view_test.cc
23:02:14 In file included from /usr/include/gtest/gtest-message.h:57,
23:02:14 from /usr/include/gtest/gtest-assertion-result.h:46,
23:02:14 from /usr/include/gtest/gtest.h:63,
23:02:14 from /usr/src/RPM/BUILD/cpu_features-0.10.0/test/string_view_test.cc:17:
23:02:14 /usr/include/gtest/internal/gtest-port.h:273:2: error: #error C++ versions less than C++17 are not supported.
23:02:14 273 | #error C++ versions less than C++17 are not supported.
23:02:14 | ^~~~~
23:02:14 In file included from /usr/include/gtest/gtest.h:67:
23:02:14 /usr/include/gtest/gtest-param-test.h:483:56: error: missing template arguments before '(' token
23:02:14 483 | typename StdFunction = decltype(std::function(std::declval<Func>()))>
23:02:14 | ^
23:02:14 /usr/include/gtest/gtest-param-test.h:493:56: error: missing template arguments before '(' token
23:02:14 493 | typename StdFunction = decltype(std::function(std::declval<Func>()))>
23:02:14 | ^
23:02:14 gmake[2]: *** [test/CMakeFiles/string_view_test.dir/build.make:79: test/CMakeFiles/string_view_test.dir/string_view_test.cc.o] Error 1
Perhaps this is related to -std=c++14 which you set in CMakeLists.txt if BUILD_TESTING is defined.
Metadata
Metadata
Assignees
Labels
compilation errorCode does not compile
Activity
Mizux commentedon May 5, 2025
FYI Google OSS C++ Policy drop support of C++14 in December 17th 2024, the now minimum supported is C++17 -> maybe Cpu Feature should align too (i.e. drop C++14 support in favor of C++17 as minimum)
ref: https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md
gchatelet commentedon May 5, 2025
Yes, I think there is not much we can do about this on our side. This is entirely linked to GTest. I think the proper way to handle this is for you to disable tests if your compiler does not support C++17 :-/ I understand this is not great though.
Marking this issue as closed as its out of our direct control.
vt-alt commentedon May 5, 2025
But, removing the offending lines from your
CMakeLists.txtstill lets the tests to compile and successfully run.vt-alt commentedon May 5, 2025
Our compiler supports C++17 since it's recent gcc 14.2.1. Your code downgrades compiler capabilities intentionally with
-std=c++14compile option. You achieve this with these lines in yourCMakeLists.txt:Mizux commentedon May 6, 2025
2 problems here:
CMAKE_CXX_STANDARDis already defined (e.g. C++20 in a super build project)...ref:
cpu_features/CMakeLists.txt
Lines 209 to 216 in 14b80e8
gchatelet commentedon May 6, 2025
Oops my bad I misread your original post and my answer was not relevant. My apologies for this.
After discussing with @Mizux we've decided to force the standard to C++17 (if not already set).
Working on a patch right now.
gchatelet commentedon May 6, 2025
@vt-alt can I ask you to check the fix?
If so, I'll add a known issue on the v0.10.0 release page and create a v0.10.1.
gchatelet commentedon May 6, 2025
Scratch that, the patch broke the CI, I'll revert it and do a proper PR.
Don't force `CXX_STANDARD` for Google Test.
Change test c++ standard handling