Home > Software design >  MINSIGSTKSZ error after update in my manjaro linux
MINSIGSTKSZ error after update in my manjaro linux

Time:03-13

After I update my system with

sudo pacman -Syu

I can’t run my college coursework and get this error

> make                                                                                
g   -c -Wall -Wpedantic -Werror -Wextra -std=c  14  main_test.cpp
In file included from /usr/include/signal.h:328,
                 from catch.hpp:8034,
                 from main_test.cpp:2:
catch.hpp:10822:58: error: call to non-‘constexpr’ function ‘long int sysconf(int)’
10822 |     static constexpr 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 catch.hpp:8034,
                 from main_test.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 main_test.cpp:2:
catch.hpp:10881:45: error: size of array ‘altStackMem’ is not an integral constant-expression
10881 |     char FatalConditionHandler::altStackMem[sigStackSize] = {};
      |                                             ^~~~~~~~~~~~
make: *** [makefile:33: main_test.o] Error 1

before I update the system, it’s run well without an error How I can fix this? I really need to fix this for my coursework

CodePudding user response:

Suprisingly https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=85e84fe53699fe9e392edffa993612ce08b2954a;hb=HEAD :

When _SC_SIGSTKSZ_SOURCE or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ are no longer constant on Linux.

I fear this change will bite many programs. This is odd, because in POSIX MINSIGSTKSZ is a constant. It is a big change.

How I can fix this?

You can:

  • downgrade your system to previous glibc or use a system with previous glibc

  • or add something like the following before the definition of sigStackSize:

      #undef MINSIGSTKSZ
      #define MINSIGSTKSZ 16384
    
  • or fix catch.hpp so that it doesn't assume that MINSIGSTKSZ is a constant expression, and instead mallocs the alternate stack

  • or compile without _GNU_SOURCE and without _SC_SIGSTKSZ_SOURCE macros.

  •  Tags:  
  • c
  • Related