Hello,
I'm currently trying to compile OpenWrt 21.02.1 under Ubuntu 22.04 LTS, but compilation unfortunately fails with the following error, due to ccache-4.1:
[ 72%] Built target ccache
[ 73%] Building CXX object unittest/CMakeFiles/unittest.dir/main.cpp.o
In file included from /home/phd/OpenWrt-V2X/build_dir/host/ccache-4.1/unittest/main.cpp:27:
/home/phd/OpenWrt-V2X/build_dir/host/ccache-4.1/unittest/../src/third_party/doctest.h:4084:47: error: size of array 'altStackMem' is not an integral constant-expression
4084 | static char altStackMem[4 * SIGSTKSZ];
| ^
make[6]: *** [unittest/CMakeFiles/unittest.dir/build.make:95: unittest/CMakeFiles/unittest.dir/main.cpp.o] Error 1
make[6]: Leaving directory '/home/phd/OpenWrt-V2X/build_dir/host/ccache-4.1'
make[5]: *** [CMakeFiles/Makefile2:360: unittest/CMakeFiles/unittest.dir/all] Error 2
make[5]: Leaving directory '/home/phd/OpenWrt-V2X/build_dir/host/ccache-4.1'
make[4]: *** [Makefile:182: all] Error 2
make[4]: Leaving directory '/home/phd/OpenWrt-V2X/build_dir/host/ccache-4.1'
make[3]: *** [Makefile:43: /home/phd/OpenWrt-V2X/build_dir/host/ccache-4.1/.built] Error 2
make[3]: Leaving directory '/home/phd/OpenWrt-V2X/tools/ccache'
time: tools/ccache/compile#0.80#0.12#0.89
ERROR: tools/ccache failed to build.
make[2]: *** [tools/Makefile:159: tools/ccache/compile] Error 1
make[2]: Leaving directory '/home/phd/OpenWrt-V2X'
make[1]: *** [tools/Makefile:155: /home/phd/OpenWrt-V2X/staging_dir/host/stamp/.tools_compile_yyyyyynnyyyynyyyyyynyynnyyyynyyyyyyyyyyyyyyyynynnyyyyyyy] Error 2
make[1]: Leaving directory '/home/phd/OpenWrt-V2X'
make: *** [/home/phd/OpenWrt-V2X/include/toplevel.mk:230: world] Error 2
Unfortunately, for the time being, I need to keep working with OpenWrt 21.02.1, and I cannot upgrade to newer versions, as I have a set of custom additional patches which would probably need to be upgraded when moving to a new OpenWrt release (which is a quite time-consuming activity).
Do you know if there is any workaround to enable building again under Ubuntu 22 LTS, with gcc version 11.3.0?
diff --git a/src/sysdep.c b/src/sysdep.c
index 941b4e2..24d8832 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -1785,7 +1785,15 @@ handle_arith_signal (int sig)
/* Alternate stack used by SIGSEGV handler below. */
-static unsigned char sigsegv_stack[SIGSTKSZ];
+/* 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)];
/* Return true if SIGINFO indicates a stack overflow. */
Sorry, I thought about marking that post as it is where I posted the final patch I added to the OpenWrt build system. But, indeed, it makes much more sense to mark your reply... I just modified the "Solution" mark.