fuzzylite icon indicating copy to clipboard operation
fuzzylite copied to clipboard

Build issue with glibc 2.34

Open pcercuei opened this issue 2 years ago • 4 comments

Trying to build https://github.com/flathub/eu.vcmi.vcmi with the KDE runtime updated to 5.15-22.08.

Fuzzylite fails to build with the following error:

FAILED: CMakeFiles/fl-test.dir/test/MainTest.cpp.o 
/usr/bin/c++ -DFL_BACKTRACE -DFL_BUILD_PATH=\"/run/build/fuzzylite/fuzzylite\" -DFL_IMPORT_LIBRARY -I/run/build/fuzzylite/fuzzylite/. -pedantic -Wall -Wextra -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -O3 -DNDEBUG   -std=c++11 -Wno-address -MD -MT CMakeFiles/fl-test.dir/test/MainTest.cpp.o -MF CMakeFiles/fl-test.dir/test/MainTest.cpp.o.d -o CMakeFiles/fl-test.dir/test/MainTest.cpp.o -c /run/build/fuzzylite/fuzzylite/test/MainTest.cpp
In file included from /usr/include/signal.h:328,
                 from /run/build/fuzzylite/fuzzylite/./test/catch.hpp:6355,
                 from /run/build/fuzzylite/fuzzylite/test/MainTest.cpp:19:
/run/build/fuzzylite/fuzzylite/./test/catch.hpp:6378:33: error: size of array ‘altStackMem’ is not an integral constant-expression
 6378 |         static char altStackMem[SIGSTKSZ];
      |                                 ^~~~~~~~
/run/build/fuzzylite/fuzzylite/./test/catch.hpp:6429:45: error: size of array ‘altStackMem’ is not an integral constant-expression
 6429 |     char FatalConditionHandler::altStackMem[SIGSTKSZ] = {};
      |                                             ^~~~~~~~
[115/123] Building CXX object CMakeFiles/fl-test.dir/test/QuickTest.cpp.o
ninja: build stopped: subcommand failed.

It seems that since glibc 2.34, SIGSTKSZ is no longer necesarily a constant. See: https://sourceware.org/pipermail/libc-alpha/2021-August/129718.html

The code should probably be updated to support SIGSTKSZ not being a constant.

pcercuei avatar Aug 12 '23 09:08 pcercuei

I'd like to add that VCMI is point to commit 7aee562d6ca17f3cf42588ffb5116e03017c3c50 which is the latest in the release branch

runlevel5 avatar Sep 01 '23 01:09 runlevel5

@pcercuei what version of gcc or distro are you using?

I do not get the same issue on Fedora 38 which is on glibc 2.38. Perhaps there has been workaround in glibc itself for backward compatibility? Just my 5cent

runlevel5 avatar Sep 01 '23 01:09 runlevel5

I've done a bit of research, yes it is a well known issue because SIGSTKSZ is no longer a constant. Many projects have hardcoded the value to 32768 instead

runlevel5 avatar Sep 01 '23 01:09 runlevel5

Okay, I think I've found the solution

Please have a look at

https://github.com/fuzzylite/fuzzylite/issues/94

Could you please point to your code to the development branch instead?

runlevel5 avatar Sep 01 '23 01:09 runlevel5