package/netsnmp: add upstream patch to fix build of depending packages

Buildroot commit ed27a33ba0 bumped the
package from 5.9.4 to 5.9.5.2 which includes upstream commit
7536a8d6d3
that breaks the build of other packages depending on netsnmp like ntp:

ntpSnmpSubagentObject.c: In function 'init_ntpSnmpSubagentObject':
./ntpSnmpSubagentObject.h:51:1: error: ISO C90 forbids mixed
 declarations and code [-Werror=declaration-after-statement]
   51 | static oid oidname##_oid [] = { __VA_ARGS__ };

For details see https://github.com/net-snmp/net-snmp/issues/1035

Fixes:
https://autobuild.buildroot.net/results/395/395a3b18719e4ec0c0b94b0692caaa9566ee57c6/

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
(cherry picked from commit 139025f793)
Signed-off-by: Titouan Christophe <titouan.christophe@mind.be>
This commit is contained in:
Bernd Kuhls
2026-06-24 08:05:29 +02:00
committed by Titouan Christophe
parent d485b0677c
commit d446361292
2 changed files with 84 additions and 0 deletions

View File

@@ -0,0 +1,80 @@
From 6facf270a6b9850846f015e64b8347319069fd57 Mon Sep 17 00:00:00 2001
From: Wes Hardaker <opensource@hardakers.net>
Date: Mon, 29 Dec 2025 13:38:59 -0800
Subject: [PATCH] moving -Werror=declaration-after-statement to only for
developers
Upstream: https://github.com/net-snmp/net-snmp/commit/0f19435ecc8fd6c3ef9cf2a391bd7bca25539e80
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
configure.d/config_os_progs | 39 +++++++++++++++++++------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/configure.d/config_os_progs b/configure.d/config_os_progs
index b3ecf556cc..b029de6017 100644
--- a/configure.d/config_os_progs
+++ b/configure.d/config_os_progs
@@ -110,24 +110,6 @@ AC_SUBST(LIBTOOL_DEPS)
# Build environment:
##
-for opt in -Werror=declaration-after-statement
-do
- AC_MSG_CHECKING([whether the compiler supports $opt])
- netsnmp_save_CFLAGS="$CFLAGS"
- if test x$opt != x-Wstrict-prototypes; then
- CFLAGS="-Werror $opt $CFLAGS"
- else
- CFLAGS="$opt $CFLAGS"
- fi
- AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
- AC_MSG_RESULT([yes])
- CFLAGS="$opt $netsnmp_save_CFLAGS"
- ], [
- AC_MSG_RESULT([no])
- CFLAGS="$netsnmp_save_CFLAGS"
- ])
-done
-
# developer build
# (enabled by default when building from SVN checkout)
#
@@ -135,7 +117,7 @@ if test "x$developer" != "xno" -a -f $srcdir/remove-files; then
developer="yes"
fi
if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
- AC_MSG_CHECKING([for developer gcc flags])
+ AC_MSG_NOTICE([Checking for developer compiler flags])
# WWWXXX - strict type checking
#
netsnmp_save_CFLAGS="$CFLAGS"
@@ -159,6 +141,25 @@ if test "x$developer" = "xyes" -a "x$GCC" = "xyes"; then
CFLAGS="$netsnmp_save_CFLAGS"
done
AC_MSG_RESULT($DEVFLAGS)
+
+ for opt in -Werror=declaration-after-statement
+ do
+ AC_MSG_CHECKING([whether the compiler supports $opt])
+ netsnmp_save_CFLAGS="$CFLAGS"
+ if test x$opt != x-Wstrict-prototypes; then
+ CFLAGS="-Werror $opt $CFLAGS"
+ else
+ CFLAGS="$opt $CFLAGS"
+ fi
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], [
+ AC_MSG_RESULT([yes])
+ CFLAGS="$opt $netsnmp_save_CFLAGS"
+ ], [
+ AC_MSG_RESULT([no])
+ CFLAGS="$netsnmp_save_CFLAGS"
+ ])
+ done
+
else
DEVFLAGS=""
fi
--
2.47.3

View File

@@ -13,6 +13,10 @@ NETSNMP_CPE_ID_VENDOR = net-snmp
NETSNMP_CPE_ID_PRODUCT = $(NETSNMP_CPE_ID_VENDOR)
NETSNMP_SELINUX_MODULES = snmp
NETSNMP_INSTALL_STAGING = YES
# 0001-moving-Werror-declaration-after-statement-to-only-fo.patch
NETSNMP_AUTORECONF = YES
NETSNMP_CONF_ENV = \
ac_cv_NETSNMP_CAN_USE_SYSCTL=no \
ac_cv_path_PSPROG=/bin/ps