Skip to content

Failed to compile the code, cause SIGSTKSZ is now a run-time variable since glibc 2.34! #82

@laplacedoge

Description

@laplacedoge

For my virtual machine, the clang++ version is "Ubuntu clang version 14.0.0-1ubuntu1", and the g++ version is "gcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04)".

I tried both of them, but still got failed to compile it, here is the terminal output when using clang++:

clang++ -Ilib -Icommon -Iexternals/tinyxml   -std=c++0x -O2 -include lib/cxx11emu.h -DNDEBUG -Wall -Wno-sign-compare -Wno-unknown-pragmas -Wno-reorder  -c -o cli/tscexecutor.o cli/tscexecutor.cpp
cli/tscexecutor.cpp:322:13: error: variable length array declaration not allowed at file scope
static char mytstack[MYSTACKSIZE]; // alternative stack for signal handler
            ^        ~~~~~~~~~~~
1 error generated.
make: *** [Makefile:284: cli/tscexecutor.o] Error 1

Obviously, the option "-std=c++0x" is already specified in the compile command, but the compiler still said the length of the array "mytstack" is not constant, so I checked the code at cli/tscexecutor.cpp:322:13:

static const size_t MYSTACKSIZE = 16 * 1024 + SIGSTKSZ; // wild guess about a reasonable buffer
static char mytstack[MYSTACKSIZE]; // alternative stack for signal handler
static bool bStackBelowHeap = false; // lame attempt to locate heap vs. stack address space

SIGTKSZ is now not a macro anymore, here is the news.

Maybe it's a better choice to allocate this array dynamically now.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions