Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FS#4073 - make kernel_menuconfig fails at m4 1.4.18 in Ubuntu 21.10 because of SIGSTKSZ #9055

Closed
openwrt-bot opened this issue Oct 9, 2021 · 8 comments
Labels
flyspray release/21.02 pull request/issue targeted (also) for OpenWrt 21.02 release toolchain pull request/issue with toolchain related changes

Comments

@openwrt-bot
Copy link

dreamlayers:

I'm attempting to build openwrt 21.02 from git for a Buffalo WZR-600DHP on x86_64 Ubuntu 21.10. make kernel_menuconfig failed, and after running it with increased verbosity I see:

gcc  -I.   -I/home/bgjenero/gitapps/openwrt/staging_dir/host/include   -O2 -I/home/bgjenero/gitapps/openwrt/staging_dir/host/include  -MT c-stack.o -MD -MP -MF $depbase.Tpo -c -o c-stack.o c-stack.c &&\
mv -f $depbase.Tpo $depbase.Po
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
      |                          ^~~~~~~~

That's a failure building m4 1.4.18. It is discussed at https://lists.gnu.org/archive/html/bug-m4/2021-03/msg00000.html

The problem is that m4 is expecting SIGSTKSZ to be a compile time constant, but instead in
/usr/include/x86_64-linux-gnu/bits/sigstksz.h it is: # define SIGSTKSZ sysconf (_SC_SIGSTKSZ)

The m4 package in Ubuntu 21.10 is actually the same version, and the source package has a patch for this in https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/m4/1.4.18-5ubuntu1/m4_1.4.18-5ubuntu1.debian.tar.xz at /debian/patches/04-fix-sigstksz.patch. I am attaching that patch here.

@openwrt-bot
Copy link
Author

yarrick:

I get the same failure (using Fedora 35)

Ah, I get this only because I used a branch based on older code. master already has newer m4

@aparcar aparcar added release/21.02 pull request/issue targeted (also) for OpenWrt 21.02 release toolchain pull request/issue with toolchain related changes labels Feb 22, 2022
@detly
Copy link

detly commented Mar 17, 2022

I'm hitting this trying to compile older OpenWRT versions (18.06) on Ubuntu 21.10. Is there a simple workaround?

@NumberOneGit
Copy link

I think the workaround is to patch c-stack.c with the above patchfile.

@detly
Copy link

detly commented Mar 23, 2022

Ah, I wasn't sure whether it was the host or OpenWRT that needed patching. I actually did something else and backported the current version of m4.

@robin48gx
Copy link

Hi,

I am trying to compile the rpi-buildroot using Ubuntu 22.04.01.
The compile fails building m4 so I added lines 55-58, because, looking through
the #if logic, this should have only failed if HAVE_LIBSIGSEGV was not defined.
The subsequent compiler error proved this was the case.

Where should HAVE_LIBSIGSEGV be defined? Should it be defined ?

    54 
    55 // lines added to buildroot to determine if HAVE_LIBSIGSEGV is actually defined RPC 29SEP2022
    56 #ifndef HAVE_LIBSIGSEGV
    57 #error HAVE_LIBSIGSEGV NOT DEFINED
    58 #endif
    59 
    60 #ifndef SIGSTKSZ
    61 # define SIGSTKSZ 16384
    62 #elif HAVE_LIBSIGSEGV && SIGSTKSZ < 16384
    63 /* libsigsegv 2.6 through 2.8 have a bug where some architectures use
    64    more than the Linux default of an 8k alternate stack when deciding
    65    if a fault was caused by stack overflow.  */
    66 # undef SIGSTKSZ
    67 # define SIGSTKSZ 16384
    68 #endif

@czarnota
Copy link

czarnota commented Oct 26, 2022

I can overcome the issue by using the mentioned patch keyfour@2722d51

cd tools/m4/patches
wget https://raw.githubusercontent.com/keyfour/openwrt/2722d51c5cf6a296b8ecf7ae09e46690403a6c3d/tools/m4/patches/011-fix-sigstksz.patch

And after removing build_dir and staging_dir, the issue is gone

@ElectricRCAircraftGuy
Copy link

ElectricRCAircraftGuy commented Jan 9, 2023

See also: https://stackoverflow.com/a/69722830/4561887

Attempting to update the m4 package from v 1.4.18 to 1.4.19 may also fix the error on Ubuntu 21 or 22.

If anyone is stumbling here via Google search (like me) and is using Buildroot for an embedded-linux board, simply grab the latest m4 upstream files here to make this change: https://github.com/buildroot/buildroot/tree/master/package/m4

@ynezz
Copy link
Member

ynezz commented Jan 10, 2023

Fixed in aa2d61e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flyspray release/21.02 pull request/issue targeted (also) for OpenWrt 21.02 release toolchain pull request/issue with toolchain related changes
Projects
None yet
Development

No branches or pull requests

8 participants