emil-e/rapidcheck

clang-14 build failure on `ext/catch`

jhgorse opened this issue · 1 comments

git clone + submodules
cmake -DCMAKE_BUILD_TYPE=Debug -DRC_ENABLE_TESTS=ON -DRC_ENABLE_EXAMPLES=ON -DRC_ENABLE_GTEST=ON -DRC_ENABLE_GMOCK=ON -DRC_ENABLE_BOOST=OFF -DRC_ENABLE_BOOST_TEST=OFF -DRC_ENABLE_RTTI=ON -G Ninja ..

[root:/tmp/rapidcheck/build] # ninja
[1/4] Building CXX object test/CMakeFiles/rapidcheck_tests.dir/main.cpp.o
FAILED: test/CMakeFiles/rapidcheck_tests.dir/main.cpp.o
/usr/bin/clang++-14  -I/tmp/rapidcheck/test/. -I/tmp/rapidcheck/test/../src -I/tmp/rapidcheck/include -I/tmp/rapidcheck/ext/catch/single_include -I/tmp/rapidcheck/extras/catch/include -Wall -Wno-missing-braces -Wno-unused-command-line-argument -g -std=gnu++11 -MD -MT test/CMakeFiles/rapidcheck_tests.dir/main.cpp.o -MF test/CMakeFiles/rapidcheck_tests.dir/main.cpp.o.d -o test/CMakeFiles/rapidcheck_tests.dir/main.cpp.o -c /tmp/rapidcheck/test/main.cpp
In file included from /tmp/rapidcheck/test/main.cpp:15:
/tmp/rapidcheck/ext/catch/single_include/catch2/catch.hpp:7972:34: error: constexpr variable 'sigStackSize' must be initialized by a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
                                 ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/rapidcheck/ext/catch/single_include/catch2/catch.hpp:7972:58: note: non-constexpr function 'sysconf' cannot be used in a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
                                                         ^
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:32:22: note: expanded from macro 'MINSIGSTKSZ'
# define MINSIGSTKSZ SIGSTKSZ
                     ^
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:28:19: note: expanded from macro 'SIGSTKSZ'
# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
                  ^
/usr/include/unistd.h:640:17: note: declared here
extern long int sysconf (int __name) __THROW;
                ^
In file included from /tmp/rapidcheck/test/main.cpp:15:
/tmp/rapidcheck/ext/catch/single_include/catch2/catch.hpp:8031:33: error: variable length array declaration not allowed at file scope
    char FatalConditionHandler::altStackMem[sigStackSize] = {};
                                ^           ~~~~~~~~~~~~
2 errors generated.
[2/4] Building CXX object extras/gmock/test/CMakeFiles/rapidcheck_gmock_tests.dir/main.cpp.o
FAILED: extras/gmock/test/CMakeFiles/rapidcheck_gmock_tests.dir/main.cpp.o
/usr/bin/clang++-14 -DCATCH_CONFIG_PREFIX_ALL -I/tmp/rapidcheck/extras/gmock/include -I/tmp/rapidcheck/include -I/tmp/rapidcheck/extras/catch/include -I/tmp/rapidcheck/ext/catch/single_include -isystem /tmp/rapidcheck/ext/googletest/googletest/include -isystem /tmp/rapidcheck/ext/googletest/googlemock/include -isystem /tmp/rapidcheck/ext/googletest/googlemock -isystem /tmp/rapidcheck/ext/googletest/googletest -Wall -Wno-missing-braces -Wno-unused-command-line-argument -g -MD -MT extras/gmock/test/CMakeFiles/rapidcheck_gmock_tests.dir/main.cpp.o -MF extras/gmock/test/CMakeFiles/rapidcheck_gmock_tests.dir/main.cpp.o.d -o extras/gmock/test/CMakeFiles/rapidcheck_gmock_tests.dir/main.cpp.o -c /tmp/rapidcheck/extras/gmock/test/main.cpp
In file included from /tmp/rapidcheck/extras/gmock/test/main.cpp:2:
/tmp/rapidcheck/ext/catch/single_include/catch2/catch.hpp:7972:34: error: constexpr variable 'sigStackSize' must be initialized by a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
                                 ^              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/rapidcheck/ext/catch/single_include/catch2/catch.hpp:7972:58: note: non-constexpr function 'sysconf' cannot be used in a constant expression
    constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ;
                                                         ^
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:32:22: note: expanded from macro 'MINSIGSTKSZ'
# define MINSIGSTKSZ SIGSTKSZ
                     ^
/usr/include/x86_64-linux-gnu/bits/sigstksz.h:28:19: note: expanded from macro 'SIGSTKSZ'
# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
                  ^
/usr/include/unistd.h:640:17: note: declared here
extern long int sysconf (int __name) __THROW;
                ^
In file included from /tmp/rapidcheck/extras/gmock/test/main.cpp:2:
/tmp/rapidcheck/ext/catch/single_include/catch2/catch.hpp:8031:33: error: variable length array declaration not allowed at file scope
    char FatalConditionHandler::altStackMem[sigStackSize] = {};
                                ^           ~~~~~~~~~~~~
2 errors generated.
ninja: build stopped: subcommand failed.

Seems like this can be fixed by upgrading the catch version to >v2.13.5: catchorg/Catch2#2421