From e9221e89bcbfed0bf9f26adca88f8971142cf5ad Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Mon, 25 Mar 2024 11:29:51 -0700 Subject: net-snmp: Fix build with musl The last patch 0012-Fix-configuration-of-NETSNMP_FD_MASK_TYPE.patch brought in with 5.9.4 upgrade is not sufficient and infact has a regression introduced for clang+musl builds. Signed-off-by: Khem Raj --- .../net-snmp/0001-Android-Fix-the-build.patch | 83 ++++++++++++++++++++++ .../recipes-protocols/net-snmp/net-snmp_5.9.4.bb | 1 + 2 files changed, 84 insertions(+) create mode 100644 meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Android-Fix-the-build.patch diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Android-Fix-the-build.patch b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Android-Fix-the-build.patch new file mode 100644 index 000000000..097d9f83c --- /dev/null +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Android-Fix-the-build.patch @@ -0,0 +1,83 @@ +From b4598662a39ff6974119c900ea56a4d020eac366 Mon Sep 17 00:00:00 2001 +From: Bart Van Assche +Date: Wed, 20 Dec 2023 13:08:06 -0800 +Subject: [PATCH] Android: Fix the build + +Include for the fd_set type. In the configure script, +check whether 'unsigned long' is the underlying type of fd_set. Use +u_long instead of ulong. + +Upstream-Status: Backport [https://github.com/net-snmp/net-snmp/commit/b4598662a39ff6974119c900ea56a4d020eac366] +Signed-off-by: Khem Raj +--- + agent/mibgroup/ip-mib/data_access/ipaddress_linux.c | 4 ++-- + configure | 2 +- + configure.d/config_project_types | 2 +- + include/net-snmp/types.h | 3 +++ + 4 files changed, 7 insertions(+), 4 deletions(-) + +diff --git a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c +index b38beb57dd..232202d0f9 100644 +--- a/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c ++++ b/agent/mibgroup/ip-mib/data_access/ipaddress_linux.c +@@ -50,7 +50,7 @@ int _load_v6(netsnmp_container *container, int idx_offset); + int + netsnmp_access_ipaddress_extra_prefix_info(int index, + u_long *preferedlt, +- ulong *validlt, ++ u_long *validlt, + char *addr); + #endif + +@@ -523,7 +523,7 @@ out: + + int + netsnmp_access_ipaddress_extra_prefix_info(int index, u_long *preferedlt, +- ulong *validlt, char *addr) ++ u_long *validlt, char *addr) + { + + struct { +diff --git a/configure b/configure +index e7bf859bba..48abcbab11 100755 +--- a/configure ++++ b/configure +@@ -31577,7 +31577,7 @@ CFLAGS="$CFLAGS -Werror" + + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for the type of fd_set::fds_bits" >&5 + printf %s "checking for the type of fd_set::fds_bits... " >&6; } +-for type in __fd_mask __int32_t long\ int unknown; do ++for type in __fd_mask __int32_t long 'unsigned long' unknown; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext + /* end confdefs.h. */ + +diff --git a/configure.d/config_project_types b/configure.d/config_project_types +index a78e8ebb06..ac958d6712 100644 +--- a/configure.d/config_project_types ++++ b/configure.d/config_project_types +@@ -66,7 +66,7 @@ netsnmp_save_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -Werror" + + AC_MSG_CHECKING([for the type of fd_set::fds_bits]) +-for type in __fd_mask __int32_t long\ int unknown; do ++for type in __fd_mask __int32_t long 'unsigned long' unknown; do + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ + #include + #include +diff --git a/include/net-snmp/types.h b/include/net-snmp/types.h +index b78f53ffd7..6228170e5f 100644 +--- a/include/net-snmp/types.h ++++ b/include/net-snmp/types.h +@@ -23,6 +23,9 @@ + #endif + + #include ++#ifdef __ANDROID__ ++#include ++#endif + + #if defined(WIN32) && !defined(cygwin) + typedef HANDLE netsnmp_pid_t; +-- +2.44.0 + diff --git a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.4.bb b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.4.bb index 5da06bb6d..395b02df0 100644 --- a/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.4.bb +++ b/meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.4.bb @@ -27,6 +27,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/net-snmp/net-snmp-${PV}.tar.gz \ file://0010-net-snmp-Reproducibility-Don-t-check-build-host-for.patch \ file://0011-ac_add_search_path.m4-keep-consistent-between-32bit-.patch \ file://0012-Fix-configuration-of-NETSNMP_FD_MASK_TYPE.patch \ + file://0001-Android-Fix-the-build.patch \ " SRC_URI[sha256sum] = "8b4de01391e74e3c7014beb43961a2d6d6fa03acc34280b9585f4930745b0544" -- cgit v1.2.3-54-g00ecf