From bd10a0172fa27be4d2d9a90a756319dc8a3371fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Lebrun?= Date: Fri, 28 Aug 2026 18:46:47 +0200 Subject: [PATCH] package/bpftool: disable feature auto-detection for host build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On my system: $ readelf -d host/sbin/bpftool | awk '/NEEDED/ {$1=""; print}' (NEEDED) Shared library: [libelf.so.1] # ACK (NEEDED) Shared library: [libz.so.1] # ACK (NEEDED) Shared library: [libcap.so.2] # NACK (NEEDED) Shared library: [libLLVM.so.22.1] # NACK (NEEDED) Shared library: [libc.so.6] # ACK After: $ readelf -d host/sbin/bpftool | awk '/NEEDED/ {$1=""; print}' (NEEDED) Shared library: [libelf.so.1] (NEEDED) Shared library: [libz.so.1] (NEEDED) Shared library: [libc.so.6] Host bpftool auto-detects optional features by probing the system. In my case it finds: - libcap which resolves to my system shared object because BR2_PACKAGE_LIBCAP=n. - libLLVM which resolves to the BR2-built one thanks to llvm-config in $PATH. But we don't have that marked as an explicit dependency. Avoid the mechanism by hardcoding FEATURE_TESTS to the empty string. Goal is to make the host-bpftool more hermetic to the host system. If we ever need those features (future xdp-tools package doesn't), then we'll add the dependency explicitly. Signed-off-by: Théo Lebrun Signed-off-by: Thomas Petazzoni --- package/bpftool/bpftool.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/package/bpftool/bpftool.mk b/package/bpftool/bpftool.mk index 1b765ba38f..94be9f6754 100644 --- a/package/bpftool/bpftool.mk +++ b/package/bpftool/bpftool.mk @@ -13,6 +13,9 @@ BPFTOOL_LICENSE_FILES = LICENSE LICENSE.BSD-2-Clause LICENSE.GPL-2.0 BPFTOOL_DEPENDENCIES = binutils elfutils HOST_BPFTOOL_DEPENDENCIES = host-elfutils host-pkgconf host-zlib +# Disable the auto detection of features on the host system. +HOST_BPFTOOL_MAKE_OPTS = FEATURE_TESTS= + ifeq ($(BR2_PACKAGE_LIBCAP),y) BPFTOOL_DEPENDENCIES += libcap endif @@ -28,7 +31,7 @@ endef define HOST_BPFTOOL_BUILD_CMDS $(HOST_MAKE_ENV) $(HOST_CONFIGURE_OPTS) $(MAKE) \ - -C $(@D)/src + -C $(@D)/src $(HOST_BPFTOOL_MAKE_OPTS) endef define BPFTOOL_INSTALL_TARGET_CMDS