From e4dce9e787a401a0d4761c02853e0d9eddc9b8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Holger=20Hoffst=C3=A4tte?= Date: Mon, 20 Apr 2026 22:03:51 +0200 Subject: [PATCH] sys-libs/libcap-ng: check for BTF kernel info with USE=bpf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes: https://bugs.gentoo.org/972898 Signed-off-by: Holger Hoffstätte Part-of: https://codeberg.org/gentoo/gentoo/pulls/681 Merges: https://codeberg.org/gentoo/gentoo/pulls/681 Signed-off-by: Sam James --- sys-libs/libcap-ng/libcap-ng-0.9.3.ebuild | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys-libs/libcap-ng/libcap-ng-0.9.3.ebuild b/sys-libs/libcap-ng/libcap-ng-0.9.3.ebuild index d50163ebb2ea5..ce2a6c8685186 100644 --- a/sys-libs/libcap-ng/libcap-ng-0.9.3.ebuild +++ b/sys-libs/libcap-ng/libcap-ng-0.9.3.ebuild @@ -42,6 +42,18 @@ PATCHES=( "${FILESDIR}"/${PN}-0.9.3-audit-out-of-source-build.patch ) +pkg_pretend() { + # bug 972898 + if use bpf && [[ ${MERGE_TYPE} != binary ]] ; then + if [[ ! -f /sys/kernel/btf/vmlinux ]] ; then + local err="Cannot read /sys/kernel/btf/vmlinux, which is required by bpftool.\n" + err+=" Typically this means that your kernel is missing the DEBUG_INFO_BTF option,\n" + err+=" without which BPF cannot work. Please build with USE=-bpf or reconfigure your kernel." + die "${err}" + fi + fi +} + src_prepare() { default