laudrup / lz4_stream

A C++ stream using LZ4 (de)compression
BSD 3-Clause "New" or "Revised" License
39 stars 13 forks source link

Unit Tests won't Compile with Gcc 11 #7

Open mightypenguin opened 2 years ago

mightypenguin commented 2 years ago

Unit testing library "Catch2" throws error on OS: amazonlinux:2022

Compiler (OS Default): g++ (GCC) 11.2.1 20210728 (Red Hat 11.2.1-2)

Error can be avoided by disabling the tests with: cmake -DLZ4_STREAM_BuildTests=OFF ..

(It's referring to "MINSIGSTKSZ" as being non-constant)

Example Error output: [ 80%] Completed 'Catch2' [ 80%] Built target Catch2 [ 86%] Building CXX object test/CMakeFiles/lz4_stream_test.dir/main.cpp.o [ 93%] Building CXX object test/CMakeFiles/lz4_stream_test.dir/lz4_stream_test.cpp.o In file included from /usr/include/signal.h:328, from /build_dep/src/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:5903, from /build_dep/src/lz4_stream/test/main.cpp:2: /build_dep/src/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8525:58: error: call to non-'constexpr' function 'long int sysconf(int)' 8525 | constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; | ^~~~~~~~~~~ In file included from /usr/include/bits/sigstksz.h:24, from /usr/include/signal.h:328, from /build_dep/src/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:5903, from /build_dep/src/lz4_stream/test/main.cpp:2: /usr/include/unistd.h:640:17: note: 'long int sysconf(int)' declared here 640 | extern long int sysconf (int __name) __THROW; | ^~~~~~~ In file included from /build_dep/src/lz4_stream/test/main.cpp:2: /build_dep/src/lz4_stream/build/thirdparty/catch2/Catch2-prefix/src/Catch2/single_include/catch2/catch.hpp:8584:45: error: size of array 'altStackMem' is not an integral constant-expression 8584 | char FatalConditionHandler::altStackMem[sigStackSize] = {}; | ^~~~~~~~~~~~ make[2]: *** [test/CMakeFiles/lz4_stream_test.dir/build.make:76: test/CMakeFiles/lz4_stream_test.dir/main.cpp.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:198: test/CMakeFiles/lz4_stream_test.dir/all] Error 2 make: *** [Makefile:101: all] Error 2

laudrup commented 2 years ago

Hi @mightypenguin

To be honest I haven't really kept this project updated in any way for quite a while but it nice to see some interest.

I haven't been able to reproduce the issue, but I think it should be fixed in later version of Catch2. Could you please try to upgrade the version in thirdparty/catch2/CMakeLists.txt or checkout this branch and try to see if that fixes the issue?

If that does indeed fix the issue I should probably look into converting the existing Travis CI integration to use Github Actions instead since I cannot use Travis any longer.

Thanks a lot!