6

I am trying to compile linux for RISCV Arch using buildroot(busybox). I was using 18.04 and 20.04 previously and had no issues compiling it. Right now, I have upgraded it to 21.10 for building some other stuffs. I have moved my toolchain and I can find it using the which command. When I try to compile linux I get some error which I havn't faced in the earlier versions.

>>> host-m4 1.4.18 Building

In file included from /usr/include/signal.h:328,
                 from ./signal.h:52,
                 from c-stack.c:49:
c-stack.c:55:26: error: missing binary operator before token "("
   55 | #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
      |                          ^~~~~~~~
  CC       closein.o
c-stack.c:134:8: error: variably modified 'buffer' at file scope
  134 |   char buffer[SIGSTKSZ];
      |        ^~~~~~
  CC       closeout.o

I am confused on how different versions can cause this error.

Thanks in advance.

turbo
  • 87
  • 2
  • 8
  • Facing similar error when trying to build for Raspberry Pi 4 64 bit using Yocto v2.7 (warrior) on Ubuntu 21.10. Were you able to fix this issue? – kiner_shah Jul 20 '22 at 10:24

3 Answers3

3

It looks like you have hit a change in GNU C Library version 2.34 that can make SIGSTKSZ non-constant.

From the GNU C Library 2.34 release announcement:

  • Add _SC_MINSIGSTKSZ and _SC_SIGSTKSZ. When _DYNAMIC_STACK_SIZE_SOURCE or _GNU_SOURCE are defined, MINSIGSTKSZ and SIGSTKSZ are no longer constant on Linux. MINSIGSTKSZ is redefined to sysconf(_SC_MINSIGSTKSZ) and SIGSTKSZ is redefined to sysconf (_SC_SIGSTKSZ). This supports dynamic sized register sets for modern architectural features like Arm SVE.

A possible workaround is to configure buildroot to build host-m4 version 1.4.19 instead of 1.4.18, because it no longer uses SIGSTKSZ.

Ian Abbott
  • 15,083
  • 19
  • 33
1

I saw that error when building on Ubuntu 22.04 for an embedded Linux board using Buildroot. It got stuck when building the host-m4 package. @Ian Abbott is right:

A possible workaround is to configure buildroot to build host-m4 version 1.4.19 instead of 1.4.18, because it no longer uses SIGSTKSZ.

In Buildroot, to update from m4 v 1.4.18 to 1.4.19, simply grab the latest files here: https://github.com/buildroot/buildroot/tree/master/package/m4

As of right now (9 Jan. 2023), the upstream Buildroot m4 version there is 1.4.19, as shown here: https://github.com/buildroot/buildroot/blob/master/package/m4/m4.mk#L7:

################################################################################
#
# m4
#
################################################################################

M4_VERSION = 1.4.19
M4_SOURCE = m4-$(M4_VERSION).tar.xz
M4_SITE = $(BR2_GNU_MIRROR)/m4
M4_LICENSE = GPL-3.0+
M4_LICENSE_FILES = COPYING

$(eval $(host-autotools-package))

How to upgrade/update any buildroot package to the latest upstream version, from the command-line

Here is an example of how to upgrade any buildroot package from the command-line. In these commands, I am upgrading the m4 package, to solve the problem in the OP's question. Change the word m4 in all 3 places to the name of the package you'd like to update:

# initially:
cd path/to/buildroot
git remote add upstream https://github.com/buildroot/buildroot.git
git fetch upstream master

# then (from within the "buildroot" repo or subrepo)
rm -r package/m4
git checkout upstream/master -- package/m4
git add -A
git status
git commit -m "Update m4 library"
Gabriel Staples
  • 36,492
  • 15
  • 194
  • 265
0

See https://github.com/openwrt/openwrt/issues/9055 if you cannot upgrade to 1.4.19. You can apply patch 04 from the linked dev to fix it.

J. Aarts
  • 144
  • 2
  • 10