Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/netsnmp: add upstream patch to fix build of depending packages
@ 2026-06-24  6:05 Bernd Kuhls
  2026-08-20 22:15 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 2+ messages in thread
From: Bernd Kuhls @ 2026-06-24  6:05 UTC (permalink / raw)
  To: buildroot

Buildroot commit ed27a33ba04fafdb28d5c74a53798c86aecd50e1 bumped the
package from 5.9.4 to 5.9.5.2 which includes upstream commit
https://github.com/net-snmp/net-snmp/commit/7536a8d6d363898e0f511aa81cf2dc000c452b89
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>
---
Gitlab pipelines passed:
https://gitlab.com/bkuhls/buildroot/-/commits/1a96666c0e8fd2e9dcd23ae797782a8f188be7bf

 ...claration-after-statement-to-only-fo.patch | 80 +++++++++++++++++++
 package/netsnmp/netsnmp.mk                    |  4 +
 2 files changed, 84 insertions(+)
 create mode 100644 package/netsnmp/0001-moving-Werror-declaration-after-statement-to-only-fo.patch

diff --git a/package/netsnmp/0001-moving-Werror-declaration-after-statement-to-only-fo.patch b/package/netsnmp/0001-moving-Werror-declaration-after-statement-to-only-fo.patch
new file mode 100644
index 0000000000..64192b0993
--- /dev/null
+++ b/package/netsnmp/0001-moving-Werror-declaration-after-statement-to-only-fo.patch
@@ -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
+
diff --git a/package/netsnmp/netsnmp.mk b/package/netsnmp/netsnmp.mk
index 0ec4cfaa76..55e5997734 100644
--- a/package/netsnmp/netsnmp.mk
+++ b/package/netsnmp/netsnmp.mk
@@ -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
-- 
2.47.3

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/netsnmp: add upstream patch to fix build of depending packages
  2026-06-24  6:05 [Buildroot] [PATCH 1/1] package/netsnmp: add upstream patch to fix build of depending packages Bernd Kuhls
@ 2026-08-20 22:15 ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2026-08-20 22:15 UTC (permalink / raw)
  To: Bernd Kuhls; +Cc: buildroot

On Wed, Jun 24, 2026 at 08:05:29AM +0200, Bernd Kuhls wrote:
> Buildroot commit ed27a33ba04fafdb28d5c74a53798c86aecd50e1 bumped the
> package from 5.9.4 to 5.9.5.2 which includes upstream commit
> https://github.com/net-snmp/net-snmp/commit/7536a8d6d363898e0f511aa81cf2dc000c452b89
> 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>

Thanks, applied to master!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-20 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-24  6:05 [Buildroot] [PATCH 1/1] package/netsnmp: add upstream patch to fix build of depending packages Bernd Kuhls
2026-08-20 22:15 ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox