From 00864e5fe55f57587f47a1daabf79cee6ec5c563 Mon Sep 17 00:00:00 2001 From: Yureka Date: Mon, 25 Aug 2025 22:46:17 +0200 Subject: [PATCH] libbpf: fix sysinfo redefinition with musl (#436237) --- pkgs/os-specific/linux/libbpf/default.nix | 6 ++++ ...from-linux-kernel-h-to-linux-const-h.patch | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 pkgs/os-specific/linux/libbpf/sync-uapi-move-constants-from-linux-kernel-h-to-linux-const-h.patch diff --git a/pkgs/os-specific/linux/libbpf/default.nix b/pkgs/os-specific/linux/libbpf/default.nix index 01806675843e..0f8a08b25789 100644 --- a/pkgs/os-specific/linux/libbpf/default.nix +++ b/pkgs/os-specific/linux/libbpf/default.nix @@ -24,6 +24,12 @@ stdenv.mkDerivation rec { hash = "sha256-igjjwirg3O5mC3DzGCAO9OgrH2drnE/gV6NH7ZLNnFE="; }; + patches = [ + # Fix redefinition when using linux/netlink.h from libbpf with musl + # https://github.com/libbpf/libbpf/pull/919 + ./sync-uapi-move-constants-from-linux-kernel-h-to-linux-const-h.patch + ]; + nativeBuildInputs = [ pkg-config ]; buildInputs = [ elfutils diff --git a/pkgs/os-specific/linux/libbpf/sync-uapi-move-constants-from-linux-kernel-h-to-linux-const-h.patch b/pkgs/os-specific/linux/libbpf/sync-uapi-move-constants-from-linux-kernel-h-to-linux-const-h.patch new file mode 100644 index 000000000000..70b17dd218ff --- /dev/null +++ b/pkgs/os-specific/linux/libbpf/sync-uapi-move-constants-from-linux-kernel-h-to-linux-const-h.patch @@ -0,0 +1,28 @@ +From 448f3f2e2065a5ef20010133dae58c5311ecc538 Mon Sep 17 00:00:00 2001 +From: Yureka +Date: Sat, 23 Aug 2025 18:24:07 +0200 +Subject: [PATCH] sync: uapi: move constants from to + + +This change was applied to the kernel tree in 2020 afaict, to fix redefinition issues with musl-libc. + +I ran into this issue while building with the headers included with libbpf, since it seems they were not synced since then. + +Signed-off-by: Yureka Lilian +--- + include/uapi/linux/netlink.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/uapi/linux/netlink.h b/include/uapi/linux/netlink.h +index b857821e3..e900b1f88 100644 +--- a/include/uapi/linux/netlink.h ++++ b/include/uapi/linux/netlink.h +@@ -2,7 +2,7 @@ + #ifndef __LINUX_NETLINK_H + #define __LINUX_NETLINK_H + +-#include ++#include + #include /* for __kernel_sa_family_t */ + #include +