Subject: bug#51254: sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope

From: Håkon Hægland <[email-masked]>
Date: Mon, 18 Oct 2021 13:41:47 +0200

Thanks! I tried version 29.0.50 at https://github.com/emacs-mirror/emacs.git
and it compiles fine:

$ git clone https://github.com/emacs-mirror/emacs.git
$ cd emacs
$ ./autogen.sh
$ ./configure --prefix=/opt/emacs-29
$ make
$ sudo make install
$ /opt/emacs-29/bin/emacs --version
GNU Emacs 29.0.50
Copyright (C) 2021 Free Software Foundation, Inc.
GNU Emacs comes with ABSOLUTELY NO WARRANTY.
You may redistribute copies of GNU Emacs
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING.

On Mon, Oct 18, 2021 at 4:28 AM Eli Zaretskii <[email-masked]> wrote:

> > From: Håkon Hægland
> >  <[email-masked]>
> > Date: Sun, 17 Oct 2021 22:49:08 +0200
> >
> > I am trying to install emacs 27.2 from source on Ubuntu 21.10:
> >
> > $ gcc --version
> > gcc (Ubuntu 11.2.0-7ubuntu2) 11.2.0
> > [...]
> >   CC       sysdep.o
> > sysdep.c:1821:22: error: variably modified ‘sigsegv_stack’ at file scope
> >  1821 | static unsigned char sigsegv_stack[SIGSTKSZ];
> >       |                      ^~~~~~~~~~~~~
> > make[1]: *** [Makefile:406: sysdep.o] Error 1
> > make[1]: Leaving directory
> '/home/hakon/test/install_emacs/emacs-27.2/src'
> > make: *** [Makefile:424: src] Error 2
>
> This is due to a change in your system headers.
>
> There won't be any Emacs 27 releases, and the problem is fixed in the
> current development sources, which will become Emacs 28.1.  So my
> suggestion is to use the code we have there now:
>
>   /* Storage for the alternate signal stack.
>      64 KiB is not too large for Emacs, and is large enough
>      for all known platforms.  Smaller sizes may run into trouble.
>      For example, libsigsegv 2.6 through 2.8 have a bug where some
>      architectures use more than the Linux default of an 8 KiB alternate
>      stack when deciding if a fault was caused by stack overflow.  */
>   static max_align_t sigsegv_stack[(64 * 1024
>                                     + sizeof (max_align_t) - 1)
>                                    / sizeof (max_align_t)];
>