Skip to contentSkip to conversation

net-snmp: Fix build with musl

PATCH New Khem Raj 1 participant 4 messages Mar 25, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/4 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.

---
 .../net-snmp/0001-Android-Fix-the-build.patch | 83 +++++++++++++++++++
 .../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
meta-networking/recipes-protocols/net-snmp/net-snmp/0001-Android-Fix-the-build.patch new file +83 -0
new file mode 100644
index 0000000000..097d9f83cd
@@ -0,0 +1,83 @@
+From b4598662a39ff6974119c900ea56a4d020eac366 Mon Sep 17 00:00:00 2001
+From: Bart Van Assche <[email protected]>
+Date: Wed, 20 Dec 2023 13:08:06 -0800
+Subject: [PATCH] Android: Fix the build
+
+Include <sys/select.h> 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 <[email protected]>
+---
+ 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 <sys/select.h>
+ #include <stddef.h>
+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 <sys/types.h>
++#ifdef __ANDROID__
++#include <sys/select.h>
++#endif
+ 
+ #if defined(WIN32) && !defined(cygwin)
+ typedef HANDLE netsnmp_pid_t;
+-- 
+2.44.0
+
meta-networking/recipes-protocols/net-snmp/net-snmp_5.9.4.bb +1 -0
index 5da06bb6d7..395b02df00 100644
@@ -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"
 
Signature · 1 line
2.44.0
author
#1 lore raw

PATCH 2/4 rdma-core: Fix build with musl >= 1.2.5

---
 .../0001-include-libgen.h-for-basename.patch  | 58 +++++++++++++++++++
 .../rdma-core/rdma-core_50.0.bb               |  4 +-
 2 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-support/rdma-core/rdma-core/0001-include-libgen.h-for-basename.patch
meta-networking/recipes-support/rdma-core/rdma-core/0001-include-libgen.h-for-basename.patch new file +58 -0
new file mode 100644
index 0000000000..a093e47048
@@ -0,0 +1,58 @@
+From ae6adc4c748e67919fdf8ae1d44c619ee104c271 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 25 Mar 2024 11:37:41 -0700
+Subject: [PATCH] include libgen.h for basename
+
+basename prototype has been removed from string.h from latest musl [1]
+compilers e.g. clang-18 flags the absense of prototype as error. therefore
+include libgen.h for providing it.
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Upstream-Status: Submitted [https://github.com/linux-rdma/rdma-core/pull/1443]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ kernel-boot/rdma_rename.c  | 1 +
+ librdmacm/examples/rping.c | 1 +
+ providers/mlx5/mlx5_vfio.c | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/kernel-boot/rdma_rename.c b/kernel-boot/rdma_rename.c
+index 4af9e4a39..5193ac411 100644
+--- a/kernel-boot/rdma_rename.c
++++ b/kernel-boot/rdma_rename.c
+@@ -2,6 +2,7 @@
+ /* Copyright (c) 2019, Mellanox Technologies. All rights reserved. See COPYING file */
+ 
+ #define _GNU_SOURCE
++#include <libgen.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+diff --git a/librdmacm/examples/rping.c b/librdmacm/examples/rping.c
+index cc16ad910..0f1321458 100644
+--- a/librdmacm/examples/rping.c
++++ b/librdmacm/examples/rping.c
+@@ -33,6 +33,7 @@
+ #define _GNU_SOURCE
+ #include <endian.h>
+ #include <getopt.h>
++#include <libgen.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <stdio.h>
+diff --git a/providers/mlx5/mlx5_vfio.c b/providers/mlx5/mlx5_vfio.c
+index cd0c41462..4d064b1fc 100644
+--- a/providers/mlx5/mlx5_vfio.c
++++ b/providers/mlx5/mlx5_vfio.c
+@@ -6,6 +6,7 @@
+ #define _GNU_SOURCE
+ #include <config.h>
+ 
++#include <libgen.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
+-- 
+2.44.0
+
meta-networking/recipes-support/rdma-core/rdma-core_50.0.bb +3 -1
index d0f4fd47a5..ab4de22a51 100644
@@ -6,7 +6,9 @@ DEPENDS = "libnl"
 RDEPENDS:${PN} = "bash perl"
 
 SRC_URI = "git://github.com/linux-rdma/rdma-core.git;branch=master;protocol=https \
-           file://0001-cmake-Allow-SYSTEMCTL_BIN-to-be-overridden-from-envi.patch"
+           file://0001-cmake-Allow-SYSTEMCTL_BIN-to-be-overridden-from-envi.patch \
+           file://0001-include-libgen.h-for-basename.patch \
+"
 SRCREV = "bc6b4bc134532e952fe7f8efc251e1f89b912098"
 S = "${WORKDIR}/git"
 
Signature · 1 line
2.44.0
author
#2 lore raw

PATCH 3/4 ssmtp: Fix build with musl >= 1.2.5

In reply to Khem Raj
---
 .../0001-include-libgen.h-for-basename.patch  | 32 +++++++++++++++++++
 .../recipes-support/ssmtp/ssmtp_2.64.bb       |  1 +
 2 files changed, 33 insertions(+)
 create mode 100644 meta-networking/recipes-support/ssmtp/ssmtp/0001-include-libgen.h-for-basename.patch
meta-networking/recipes-support/ssmtp/ssmtp/0001-include-libgen.h-for-basename.patch new file +32 -0
new file mode 100644
index 0000000000..094ba5afa2
@@ -0,0 +1,32 @@
+From b48840952ec9a68363bed960e98dd6c7aaa3acec Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 25 Mar 2024 11:55:59 -0700
+Subject: [PATCH] include libgen.h for basename
+
+basename prototype has been removed from string.h from latest musl [1]
+compilers e.g. clang-18 flags the absense of prototype as error. therefore
+include libgen.h for providing it.
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ ssmtp.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/ssmtp.c b/ssmtp.c
+index 0a719ac..4dedaf8 100644
+--- a/ssmtp.c
++++ b/ssmtp.c
+@@ -23,6 +23,7 @@
+ #include <signal.h>
+ #include <setjmp.h>
+ #include <string.h>
++#include <libgen.h>
+ #include <ctype.h>
+ #include <netdb.h>
+ #ifdef HAVE_SSL
+-- 
+2.44.0
+
meta-networking/recipes-support/ssmtp/ssmtp_2.64.bb +1 -0
index 05d2bb18ff..499a79d1ed 100644
@@ -8,6 +8,7 @@ SRC_URI = "${DEBIAN_MIRROR}/main/s/${BPN}/${BPN}_${PV}.orig.tar.bz2 \
            file://build-ouside_srcdir.patch \
            file://use-DESTDIR.patch \
            file://0001-ssmtp-Correct-the-null-pointer-assignment-to-char-po.patch \
+           file://0001-include-libgen.h-for-basename.patch \
            "
 
 SRC_URI[md5sum] = "65b4e0df4934a6cd08c506cabcbe584f"
Signature · 1 line
2.44.0
author
#3 lore raw

PATCH 4/4 autofs: Fix build with musl >= 1.2.5

In reply to Khem Raj
---
 .../0001-include-libgen.h-for-basename.patch  | 58 +++++++++++++++++++
 .../recipes-daemons/autofs/autofs_5.1.8.bb    |  1 +
 2 files changed, 59 insertions(+)
 create mode 100644 meta-networking/recipes-daemons/autofs/autofs/0001-include-libgen.h-for-basename.patch
meta-networking/recipes-daemons/autofs/autofs/0001-include-libgen.h-for-basename.patch new file +58 -0
new file mode 100644
index 0000000000..4c8b4ef779
@@ -0,0 +1,58 @@
+From 1651e7a35be8b3e2fa90ca57b073f6944664fa62 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Mon, 25 Mar 2024 12:04:03 -0700
+Subject: [PATCH] include libgen.h for basename
+
+basename prototype has been removed from string.h from latest musl [1]
+compilers e.g. clang-18 flags the absense of prototype as error. therefore
+include libgen.h for providing it.
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Upstream-Status: Pending
+Signed-off-by: Khem Raj <[email protected]>
+---
+ daemon/automount.c    | 1 +
+ daemon/master.c       | 1 +
+ modules/lookup_file.c | 1 +
+ 3 files changed, 3 insertions(+)
+
+diff --git a/daemon/automount.c b/daemon/automount.c
+index 3d9461d..61b3478 100644
+--- a/daemon/automount.c
++++ b/daemon/automount.c
+@@ -21,6 +21,7 @@
+ 
+ #include <dirent.h>
+ #include <getopt.h>
++#include <libgen.h>
+ #include <signal.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+diff --git a/daemon/master.c b/daemon/master.c
+index f99359c..3f56499 100644
+--- a/daemon/master.c
++++ b/daemon/master.c
+@@ -21,6 +21,7 @@
+ #include <string.h>
+ #include <memory.h>
+ #include <limits.h>
++#include <libgen.h>
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+diff --git a/modules/lookup_file.c b/modules/lookup_file.c
+index 6afc558..82b1f28 100644
+--- a/modules/lookup_file.c
++++ b/modules/lookup_file.c
+@@ -15,6 +15,7 @@
+ 
+ #include <stdio.h>
+ #include <malloc.h>
++#include <libgen.h>
+ #include <stdlib.h>
+ #include <string.h>
+ #include <time.h>
+-- 
+2.44.0
+
meta-networking/recipes-daemons/autofs/autofs_5.1.8.bb +1 -0
index ca11f1a170..e3f9777380 100644
@@ -29,6 +29,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/daemons/autofs/v5/autofs-${PV}.tar.gz \
            file://mount_conflict.patch \
            file://0001-autofs-5.1.8-add-autofs_strerror_r-helper-for-musl.patch \
            file://0002-autofs-5.1.8-handle-innetgr-not-present-in-musl.patch \
+           file://0001-include-libgen.h-for-basename.patch \
            "
 SRC_URI[sha256sum] = "0bd401c56f0eb1ca6251344c3a3d70bface3eccf9c67117cd184422c4cace30c"
 
Signature · 1 line
2.44.0