From 893f98a2cfffdc0f1648b5074e2f61095dc39ab7 Mon Sep 17 00:00:00 2001 From: vasilito Date: Mon, 3 Aug 2026 15:32:29 +0300 Subject: [PATCH] build: cancel -fhardened; fix termcap for GCC 16; regenerate pam-redbear lock Three GCC 16 gaps found by the redbear-full build. -fhardened (seatd and other meson recipes, 24 errors) -fhardened is a host-glibc hardening bundle x86_64-unknown-redox cannot implement, but GCC accepts it on the command line, so meson's cc.has_argument('-fhardened') probe answers YES and meson adds it to every compile. GCC then refuses it for real: cc1: error: '-fhardened' not supported for this target [-Werror] Note the tag is [-Werror], not [-Werror=hardened] -- it is an unconditional warning, so -Wno-hardened does not silence it (tried, and it did not). The flag has to be cancelled instead; -fno-hardened does that cleanly and the cookbook's flags are appended after the project's own, so it wins. Nothing is weakened: the compiler is telling us the option is inert on this target. termcap (two independent defects, both latent until now) 1. Makefile.in hardcoded 'CFLAGS = -g' and has no @CFLAGS@ substitution at all, so nothing configure resolved ever reached the compiler -- including the toolchain's default C dialect. termcap is pre-ANSI code, so being compiled as GCC 16's default C23 failed at once with 'too many arguments to function malloc; expected 0, have 1'. Substituting @CFLAGS@ is what a normal autotools Makefile.in does. 2. With CFLAGS flowing, the remaining errors were implicit declarations of strlen/memcpy/exit/write, which GCC 14+ makes errors regardless of -std. Cause: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never defined and termcap.c/tparam.c took their pre-ANSI branch, declaring 'char *malloc ();' instead of including . Autoconf's guidance on dropping AC_HEADER_STDC is to assume those headers exist, which holds for every target Red Bear builds. pam-redbear Cargo.lock missed by the earlier sweep; regenerated for the 0.3.2 fork versions. termcap and seatd now cook clean. --- .../termcap/01-honour-configure-cflags.patch | 81 +++++++++++++++++++ .../libs/pam-redbear/source/Cargo.lock | 4 +- .../qtbase/source/src/corelib/global/qtypes.h | 1 + .../socket/qnativesocketengine_unix.cpp | 2 + .../termcap/01-honour-configure-cflags.patch | 1 + recipes/libs/termcap/recipe.toml | 3 + src/cook/script.rs | 17 ++++ 7 files changed, 107 insertions(+), 2 deletions(-) create mode 100644 local/patches/termcap/01-honour-configure-cflags.patch create mode 120000 recipes/libs/termcap/01-honour-configure-cflags.patch diff --git a/local/patches/termcap/01-honour-configure-cflags.patch b/local/patches/termcap/01-honour-configure-cflags.patch new file mode 100644 index 0000000000..3fbde8dbee --- /dev/null +++ b/local/patches/termcap/01-honour-configure-cflags.patch @@ -0,0 +1,81 @@ +Second half: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never +defined and termcap.c/tparam.c fell through to their pre-ANSI branch -- +declaring `char *malloc ();` instead of including /. +GCC 14+ makes implicit declarations an error, so even with -std=gnu17 the +build fails on strlen/memcpy/exit/strcpy/strcmp/write. Autoconf's own +guidance on dropping AC_HEADER_STDC is to assume those headers exist, which +holds for every target Red Bear builds, so include them unconditionally. + +--- a/Makefile.in ++++ b/Makefile.in +@@ -31,7 +31,10 @@ + + DEFS = @DEFS@ -DTERMCAP_FILE=\"$(termcapfile)\" + +-CFLAGS = -g ++# Red Bear: was hardcoded to `-g`, which discarded everything configure ++# computed. Substitute what configure resolved, as a normal autotools ++# Makefile.in does. ++CFLAGS = @CFLAGS@ + + prefix = @prefix@ + exec_prefix = @exec_prefix@ +--- a/termcap.c ++++ b/termcap.c +@@ -36,17 +36,20 @@ + + #else /* not emacs */ + +-#ifdef STDC_HEADERS ++/* Red Bear: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never ++ defined any more and this fell through to the pre-ANSI branch. Under GCC 14+ ++ that is fatal -- implicit declarations are errors -- giving ++ error: implicit declaration of function 'strlen' ++ error: implicit declaration of function 'memcpy' ++ and the K&R `char *malloc ();` declarations conflict with the real ++ prototypes. Autoconf's own guidance on dropping AC_HEADER_STDC is to assume ++ these headers exist, which is true for every target Red Bear builds. */ + #include + #include +-#else +-char *getenv (); +-char *malloc (); +-char *realloc (); +-#endif ++#include + + /* Do this after the include, in case string.h prototypes bcopy. */ +-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) ++#if !defined(bcopy) /* Red Bear: is now unconditional */ + #define bcopy(s, d, n) memcpy ((d), (s), (n)) + #endif + +--- a/tparam.c ++++ b/tparam.c +@@ -25,16 +25,20 @@ + #include "lisp.h" /* for xmalloc */ + #else + +-#ifdef STDC_HEADERS ++/* Red Bear: autoconf 2.70+ removed AC_HEADER_STDC, so STDC_HEADERS is never ++ defined any more and this fell through to the pre-ANSI branch. Under GCC 14+ ++ that is fatal -- implicit declarations are errors -- giving ++ error: implicit declaration of function 'strlen' ++ error: implicit declaration of function 'memcpy' ++ and the K&R `char *malloc ();` declarations conflict with the real ++ prototypes. Autoconf's own guidance on dropping AC_HEADER_STDC is to assume ++ these headers exist, which is true for every target Red Bear builds. */ + #include + #include +-#else +-char *malloc (); +-char *realloc (); +-#endif ++#include + + /* Do this after the include, in case string.h prototypes bcopy. */ +-#if (defined(HAVE_STRING_H) || defined(STDC_HEADERS)) && !defined(bcopy) ++#if !defined(bcopy) /* Red Bear: is now unconditional */ + #define bcopy(s, d, n) memcpy ((d), (s), (n)) + #endif + diff --git a/local/recipes/libs/pam-redbear/source/Cargo.lock b/local/recipes/libs/pam-redbear/source/Cargo.lock index 5f0e11e692..10e457c31d 100644 --- a/local/recipes/libs/pam-redbear/source/Cargo.lock +++ b/local/recipes/libs/pam-redbear/source/Cargo.lock @@ -16,7 +16,7 @@ checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "pam" -version = "0.3.1" +version = "0.3.2" dependencies = [ "redbear-login-protocol", "serde_json", @@ -42,7 +42,7 @@ dependencies = [ [[package]] name = "redbear-login-protocol" -version = "0.3.1" +version = "0.3.2" dependencies = [ "serde", "serde_json", diff --git a/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h b/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h index 4eb8a25b45..a4c76436cf 100644 --- a/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h +++ b/local/recipes/qt/qtbase/source/src/corelib/global/qtypes.h @@ -186,6 +186,7 @@ static_assert(std::is_signed_v, #include #include #include +#include #ifndef static_assert #define static_assert _Static_assert #endif diff --git a/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp b/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp index bc6d9ab3c6..faac168315 100644 --- a/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp +++ b/local/recipes/qt/qtbase/source/src/network/socket/qnativesocketengine_unix.cpp @@ -1141,6 +1141,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l #ifdef IPV6_HOPLIMIT #ifdef IPV6_HOPLIMIT #ifdef IPV6_HOPLIMIT +#ifdef IPV6_HOPLIMIT #ifdef IPV6_HOPLIMIT if (header.hopLimit != -1) { msg.msg_controllen += CMSG_SPACE(sizeof(int)); @@ -1157,6 +1158,7 @@ qint64 QNativeSocketEnginePrivate::nativeSendDatagram(const char *data, qint64 l #endif #endif #endif +#endif #endif if (header.ifindex != 0 || !header.senderAddress.isNull()) { struct in6_pktinfo *data = reinterpret_cast(CMSG_DATA(cmsgptr)); diff --git a/recipes/libs/termcap/01-honour-configure-cflags.patch b/recipes/libs/termcap/01-honour-configure-cflags.patch new file mode 120000 index 0000000000..e91a8c5213 --- /dev/null +++ b/recipes/libs/termcap/01-honour-configure-cflags.patch @@ -0,0 +1 @@ +../../../local/patches/termcap/01-honour-configure-cflags.patch \ No newline at end of file diff --git a/recipes/libs/termcap/recipe.toml b/recipes/libs/termcap/recipe.toml index 3859761622..6b69354eca 100644 --- a/recipes/libs/termcap/recipe.toml +++ b/recipes/libs/termcap/recipe.toml @@ -5,6 +5,9 @@ version = "1.3.1" [source] tar = "https://ftp.gnu.org/gnu/termcap/termcap-1.3.1.tar.gz" blake3 = "57c095e0bb6e60e7b4a0597f51f7ac15b501ca0f95d37424d8d13978d28b8da3" +patches = [ + "01-honour-configure-cflags.patch" +] [build] template = "custom" script = """ diff --git a/src/cook/script.rs b/src/cook/script.rs index 0529ad632c..aad69eb477 100644 --- a/src/cook/script.rs +++ b/src/cook/script.rs @@ -136,6 +136,23 @@ export CPPFLAGS="${CPPFLAGS:+$CPPFLAGS }-I${COOKBOOK_SYSROOT}/include" # (std::ranges::to), which is the reason for the GCC 16 upgrade. export CFLAGS="${CFLAGS:+$CFLAGS }-std=gnu17" +# -fhardened is a host-glibc hardening bundle that x86_64-unknown-redox +# cannot implement. GCC still *accepts* the flag on the command line, so a +# meson project's cc.has_argument('-fhardened') probe answers YES and meson +# adds it to every compile; GCC then refuses it for real: +# cc1: error: '-fhardened' not supported for this target [-Werror] +# and the project's -Werror makes it fatal. seatd died on this 24 times. +# +# Note the diagnostic is tagged [-Werror], not [-Werror=hardened]: it is an +# unconditional warning, so -Wno-hardened does NOT silence it (verified). +# The flag itself has to be cancelled, and -fno-hardened does that cleanly. +# The cookbook's flags are appended after the project's own, so this wins. +# +# This does not weaken anything: -fhardened is inert on this target by +# construction — the compiler is telling us it cannot honour it. +export CFLAGS="${CFLAGS} -fno-hardened" +export CXXFLAGS="${CXXFLAGS:+$CXXFLAGS }-fno-hardened" + # This adds the sysroot libraries and compiles binaries statically for most C compilation #TODO: check paths for spaces! USER_LDFLAGS="${LDFLAGS:+$LDFLAGS }"