[Buildroot] [2025.02.x, PATCH 1/1] package/ipset: fix build w/ musl
Thomas Perale
thomas.perale at mind.be
Thu Sep 4 17:45:39 UTC 2025
When building ipset with musl libc the following error appeared on the
autobuilder in 2025.02.x:
```
ipset.c: In function 'main':
ipset.c:35:21: error: implicit declaration of function 'basename' [-Wimplicit-function-declaration]
35 | if (!strcmp(basename(argv[0]), "ipset-translate")) {
| ^~~~~~~~
ipset.c:35:21: error: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
35 | if (!strcmp(basename(argv[0]), "ipset-translate")) {
| ^~~~~~~~~~~~~~~~~
| |
| int
In file included from ipset.c:13:
```
This error can be reproduced with:
```
cat >.config <<EOF
BR2_aarch64=y
BR2_TOOLCHAIN_EXTERNAL=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN=y
BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_AARCH64_MUSL_BLEEDING_EDGE=y
BR2_PACKAGE_IPSET=y
EOF
make olddefconfig
make ipset
```
This patch adds the upstream commit [1], that fixes this issue by
including explicitely `libgen.h`. This patch is part of the master
branch since commit [2].
[1] https://git.netfilter.org/ipset/commit/?id=316f592ddc547c28388da4e7cb7c5c8f89cd3591
[2] 8fdbbefa08 package/ipset: bump to version 7.23
Fixes: https://autobuild.buildroot.org/results/930/930802ecc324c4cfc697191aa6a68642a4188e7b
Signed-off-by: Thomas Perale <thomas.perale at mind.be>
---
...cit-declaration-of-function-basename.patch | 31 +++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 package/ipset/0001-ipset-fix-implicit-declaration-of-function-basename.patch
diff --git a/package/ipset/0001-ipset-fix-implicit-declaration-of-function-basename.patch b/package/ipset/0001-ipset-fix-implicit-declaration-of-function-basename.patch
new file mode 100644
index 0000000000..c01fdaf671
--- /dev/null
+++ b/package/ipset/0001-ipset-fix-implicit-declaration-of-function-basename.patch
@@ -0,0 +1,31 @@
+From 316f592ddc547c28388da4e7cb7c5c8f89cd3591 Mon Sep 17 00:00:00 2001
+From: Mike Pagano <mpagano at gentoo.org>
+Date: Fri, 30 Aug 2024 11:31:19 -0400
+Subject: ipset: Fix implicit declaration of function basename
+
+basename(3) is defined in libgen.h in MUSL.
+Include libgen.h where basename(3) is used.
+
+Signed-off-by: Mike Pagano <mpagano at gentoo.org>
+Acked-by: Phil Sutter <phil at nwl.cc>
+Signed-off-by: Jozsef Kadlecsik <kadlec at netfilter.org>
+Upstream: https://git.netfilter.org/ipset/commit/?id=316f592ddc547c28388da4e7cb7c5c8f89cd3591
+Signed-off-by: Thomas Perale <thomas.perale at mind.be>
+---
+ src/ipset.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/ipset.c b/src/ipset.c
+index 162f477..d7733bf 100644
+--- a/src/ipset.c
++++ b/src/ipset.c
+@@ -15,6 +15,7 @@
+ #include <config.h>
+ #include <libipset/ipset.h> /* ipset library */
+ #include <libipset/xlate.h> /* translate to nftables */
++#include <libgen.h>
+
+ int
+ main(int argc, char *argv[])
+--
+cgit v1.2.3
--
2.39.5
More information about the buildroot
mailing list