From 7102aa5ffdbb8b9b7f2a7475fffb6486c0cd04fb Mon Sep 17 00:00:00 2001 From: Bernd Kuhls Date: Sat, 25 Apr 2026 23:16:38 +0200 Subject: [PATCH] package/libbpf: fix bpftrace build with kernel headers > 5.11 & < 6.0 Buildroot commit 97e2f63bdf4cc992787c570b17b099c41c5535d2 in 2026.02-rc1 bumped bpftrace from 0.23.3 to 0.24.2. This release includes upstream commit https://github.com/bpftrace/bpftrace/commit/d4f58382270c21b2c718aa0a6574c105f29e77a9 which was added to version 0.24.0 and makes use of btf_enum64 that was added to the linux kernel in version 6.0: https://github.com/torvalds/linux/commit/6089fb325cf737eeb2c4d236c94697112ca860da causing build errors when the toolchain contains kernel headers between versions 5.12 and 5.19 because the libbpf package does not update their headers so we need to raise the BR2_TOOLCHAIN_HEADERS_AT_LEAST_ version number again. The build error can be reproduced with this defconfig BR2_aarch64=y BR2_KERNEL_HEADERS_VERSION=y BR2_DEFAULT_KERNEL_VERSION="5.11.22" BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_11=y BR2_TOOLCHAIN_BUILDROOT_CXX=y BR2_PER_PACKAGE_DIRECTORIES=y BR2_PACKAGE_BPFTRACE=y on the 2026.02.x branch as of 0be927b89a319c9ac35249354558e9f4cb102fd0. Fixes: https://autobuild.buildroot.net/results/8f7/8f7ce88a070e825ef178275a13d969349f05593b/ Signed-off-by: Bernd Kuhls Signed-off-by: Arnout Vandecappelle --- package/libbpf/libbpf.mk | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/package/libbpf/libbpf.mk b/package/libbpf/libbpf.mk index 4b742ab966..a141497d6c 100644 --- a/package/libbpf/libbpf.mk +++ b/package/libbpf/libbpf.mk @@ -18,14 +18,14 @@ define LIBBPF_BUILD_CMDS -C $(@D)/src endef -# bpftrace uses variables from bpf_btf_info that were added since kernel -# 5.11, so we need to update some uapi headers in STAGING_DIR if the -# toolchain is build with linux-headers < 5.11. +# bpftrace uses btf_enum64 that was added since kernel 6.0 so we need to +# update some uapi headers in STAGING_DIR if the toolchain is build with +# linux-headers < 6.0. # Otherwise bpftrace is broken due to out of date linux/bpf.h installed # by the toolchain. -# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5329722057d41aebc31e391907a501feaa42f7d9 -# https://github.com/bpftrace/bpftrace/commit/fea31939899db48fa6d28f5ce880bfc39250ec9f -ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_11),) +# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=6089fb325cf737eeb2c4d236c94697112ca860da +# https://github.com/bpftrace/bpftrace/commit/d4f58382270c21b2c718aa0a6574c105f29e77a9 +ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_6_0),) LIBBPF_UPDATE_UAPI_HEADERS = install_uapi_headers UAPIDIR=/usr/include/bpf define LIBBPF_FIX_STAGING_PC