{"id":2228303,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2228303/?format=json","web_url":"http://patchwork.ozlabs.org/project/buildroot/patch/20260425211641.479665-3-bernd@kuhls.net/","project":{"id":27,"url":"http://patchwork.ozlabs.org/api/1.1/projects/27/?format=json","name":"Buildroot development","link_name":"buildroot","list_id":"buildroot.buildroot.org","list_email":"buildroot@buildroot.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260425211641.479665-3-bernd@kuhls.net>","date":"2026-04-25T21:16:36","name":"[3/8] package/bpftrace: fix build with per-package directories","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"8eb9f5e06e7aca31ca9ac81d1cbf86d0ae76216d","submitter":{"id":86624,"url":"http://patchwork.ozlabs.org/api/1.1/people/86624/?format=json","name":"Bernd Kuhls","email":"bernd@kuhls.net"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/buildroot/patch/20260425211641.479665-3-bernd@kuhls.net/mbox/","series":[{"id":501488,"url":"http://patchwork.ozlabs.org/api/1.1/series/501488/?format=json","web_url":"http://patchwork.ozlabs.org/project/buildroot/list/?series=501488","date":"2026-04-25T21:16:34","name":"[1/8] package/bpftrace: remove configure option USE_SYSTEM_BPF_BCC","version":1,"mbox":"http://patchwork.ozlabs.org/series/501488/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2228303/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2228303/checks/","tags":{},"headers":{"Return-Path":"<buildroot-bounces@buildroot.org>","X-Original-To":["incoming-buildroot@patchwork.ozlabs.org","buildroot@buildroot.org"],"Delivered-To":["patchwork-incoming-buildroot@legolas.ozlabs.org","buildroot@buildroot.org"],"Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=buildroot.org header.i=@buildroot.org\n header.a=rsa-sha256 header.s=default header.b=JuRretGo;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org\n (client-ip=2605:bc80:3010::137; helo=smtp4.osuosl.org;\n envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org)"],"Received":["from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g32hd4DH3z1yHv\n\tfor <incoming-buildroot@patchwork.ozlabs.org>;\n Sun, 26 Apr 2026 07:17:05 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 0031A421E8;\n\tSat, 25 Apr 2026 21:17:04 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id wBIkRMFbexMp; Sat, 25 Apr 2026 21:17:03 +0000 (UTC)","from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142])\n\tby smtp4.osuosl.org (Postfix) with ESMTP id 128E0421EC;\n\tSat, 25 Apr 2026 21:17:03 +0000 (UTC)","from smtp4.osuosl.org (smtp4.osuosl.org [IPv6:2605:bc80:3010::137])\n by lists1.osuosl.org (Postfix) with ESMTP id B6BB8231\n for <buildroot@buildroot.org>; Sat, 25 Apr 2026 21:17:01 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n by smtp4.osuosl.org (Postfix) with ESMTP id 9D0B9421EC\n for <buildroot@buildroot.org>; Sat, 25 Apr 2026 21:17:01 +0000 (UTC)","from smtp4.osuosl.org ([127.0.0.1])\n by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP\n id Oc4zVKYsZ4-x for <buildroot@buildroot.org>;\n Sat, 25 Apr 2026 21:17:00 +0000 (UTC)","from dd20012.kasserver.com (dd20012.kasserver.com [85.13.140.57])\n by smtp4.osuosl.org (Postfix) with ESMTPS id 5A610421E8\n for <buildroot@buildroot.org>; Sat, 25 Apr 2026 21:17:00 +0000 (UTC)","from fli4l.lan.fli4l (p4fd6c5b2.dip0.t-ipconnect.de\n [79.214.197.178])\n by dd20012.kasserver.com (Postfix) with ESMTPSA id 761C4A4C0C88;\n Sat, 25 Apr 2026 23:16:42 +0200 (CEST)","from bruckner.lan.fli4l ([192.168.1.1]:48402)\n by fli4l.lan.fli4l with esmtp (Exim 4.99.1)\n (envelope-from <bernd@kuhls.net>) id 1wGkMj-000000004gG-0Lcb;\n Sat, 25 Apr 2026 21:16:41 +0000"],"X-Virus-Scanned":["amavis at osuosl.org","amavis at osuosl.org"],"X-Comment":"SPF check N/A for local connections - client-ip=140.211.166.142;\n helo=lists1.osuosl.org; envelope-from=buildroot-bounces@buildroot.org;\n receiver=<UNKNOWN> ","DKIM-Filter":["OpenDKIM Filter v2.11.0 smtp4.osuosl.org 128E0421EC","OpenDKIM Filter v2.11.0 smtp4.osuosl.org 5A610421E8"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=buildroot.org;\n\ts=default; t=1777151823;\n\tbh=qvZvbELhQqGnr59Xaxb0v1XMtVwKwfFmJRRACK8jP00=;\n\th=From:To:Cc:Date:In-Reply-To:References:Subject:List-Id:\n\t List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:\n\t From;\n\tb=JuRretGoMra1wdwAPEnlcaseZNYqO4QKxLkMTb0fGSHfqxrUnGA4NGy6TZVMduUQm\n\t H6tA+WDMOvmWCzp4mAU7kWZRmRc+iwCUVyyEdlxkvgmK7sdCRcCMTCWGyU9FFGy8r1\n\t Amom9hcC841z2SURtnEFIlWj4BU5s8ZX749OGTtX980miD75r8Fz4E96+zgiL4DkuZ\n\t wsnXREFEWQxaChR6jPzewgvUHIU1zc2CB6zM9TzR8gufDVYWBQ0hpQ/e8OecrUStlw\n\t QDgTYjKNfYZ/zYqyKwMn6kpbBPqaXWOGTipg8wqx8ai6V+S3b1S7XhJrHsxTPhAU5J\n\t aObNpmT+ObfGw==","Received-SPF":"Pass (mailfrom) identity=mailfrom; client-ip=85.13.140.57;\n helo=dd20012.kasserver.com; envelope-from=bernd@kuhls.net;\n receiver=<UNKNOWN>","DMARC-Filter":"OpenDMARC Filter v1.4.2 smtp4.osuosl.org 5A610421E8","From":"Bernd Kuhls <bernd@kuhls.net>","To":"buildroot@buildroot.org","Cc":"Qais Yousef <qais.yousef@arm.com>,\n\tRomain Naour <romain.naour@gmail.com>","Date":"Sat, 25 Apr 2026 23:16:36 +0200","Message-ID":"<20260425211641.479665-3-bernd@kuhls.net>","X-Mailer":"git-send-email 2.47.3","In-Reply-To":"<20260425211641.479665-1-bernd@kuhls.net>","References":"<20260425211641.479665-1-bernd@kuhls.net>","MIME-Version":"1.0","X-Spamd-Bar":"+","X-Mailman-Original-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=kuhls.net;\n s=kas202511301023; t=1777151803;\n bh=Ra22NYnDTM3eidrTgn/a79L+LCRG0cOXuxm/vWvU9XU=;\n h=From:To:Cc:Subject:Date:In-Reply-To:From;\n b=hkII6enTqaiEVOSQH+X+ZXjWQB9TxIYtp9HXZeitT/099CqlhDXIBPOpxuvraQSIe\n Gf0778xmQu9yh0NHz5VOR0RmJn5x7qr2N25/9cxHWL7BH4w66EW8+zbiBHoZujKIJC\n pm12R1lj0Bm1z/xs8fDmecEkRL4Lzagf2Dn0TbRvV1+jaVrRdlWasa7PsGWjUYx1mI\n TLjchRUdi4T5M1Esb5VD3G63BDZ6smURCWVA2O8y1N2wvd1E1GId7KblvySDFxzEPg\n t4Q5N+3k+d+viNolSdZxOiilfRhkzYi/HhQv0opAankUe+MW4Fy0Au2mm6TQEgNBOZ\n +JsfopCaMhMIQ==","X-Mailman-Original-Authentication-Results":["smtp4.osuosl.org;\n dmarc=pass (p=none dis=none)\n header.from=kuhls.net","smtp4.osuosl.org;\n dkim=pass (2048-bit key,\n unprotected) header.d=kuhls.net header.i=@kuhls.net header.a=rsa-sha256\n header.s=kas202511301023 header.b=hkII6enT"],"Subject":"[Buildroot] [PATCH 3/8] package/bpftrace: fix build with\n per-package directories","X-BeenThere":"buildroot@buildroot.org","X-Mailman-Version":"2.1.30","Precedence":"list","List-Id":"Discussion and development of buildroot <buildroot.buildroot.org>","List-Unsubscribe":"<https://lists.buildroot.org/mailman/options/buildroot>,\n <mailto:buildroot-request@buildroot.org?subject=unsubscribe>","List-Archive":"<http://lists.buildroot.org/pipermail/buildroot/>","List-Post":"<mailto:buildroot@buildroot.org>","List-Help":"<mailto:buildroot-request@buildroot.org?subject=help>","List-Subscribe":"<https://lists.buildroot.org/mailman/listinfo/buildroot>,\n <mailto:buildroot-request@buildroot.org?subject=subscribe>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"buildroot-bounces@buildroot.org","Sender":"\"buildroot\" <buildroot-bounces@buildroot.org>"},"content":"Buildroot commit f7b8508e4fe9c96bf679cc5423cc1500b6523e83 added the\nlibbpf package which contains the usage of the 'install_uapi_headers'\nmake target to update toolchain headers older than kernel version 5.9.\nThis does not work with per-package directories.\n\nBuilding this defconfig that includes all packages depending on libbpf:\n\n  BR2_x86_64=y\n  BR2_x86_rocketlake=y\n  BR2_KERNEL_HEADERS_VERSION=y\n  BR2_DEFAULT_KERNEL_VERSION=\"5.8.18\"\n  BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_5_8=y\n  BR2_TOOLCHAIN_BUILDROOT_CXX=y\n  BR2_PER_PACKAGE_DIRECTORIES=y\n  BR2_PACKAGE_BPFTRACE=y\n  BR2_PACKAGE_DPDK=y\n  BR2_PACKAGE_IPROUTE2=y\n  BR2_PACKAGE_HOST_PAHOLE=y\n\non the 2026.02.x branch as of 0be927b89a319c9ac35249354558e9f4cb102fd0\nis broken:\n\noutput/build/bpftrace-0.24.2/src/attached_probe.cpp: In static member\n function 'static bpftrace::Result<std::unique_ptr<bpftrace::AttachedIterProbe> >\n bpftrace::AttachedIterProbe::make(bpftrace::Probe&,\n const bpftrace::BpfProgram&, std::optional<int>)':\noutput/build/bpftrace-0.24.2/src/attached_probe.cpp:1435:30: error:\n aggregate 'bpf_iter_link_info linfo' has incomplete type and cannot be\n defined\n 1435 |     union bpf_iter_link_info linfo;\n\nTesting the defconfig took place on the 2026.02.x branch because the\ncurrent master is broken due to the llvm bump to 22.x which causes an\nerror already during configure stage. This will be addressed by another\npatch in this series.\n\nlibbpf overwrites kernel header files installed in $STAGING_DIR when\nthey are too old by adding 'install_uapi_headers' as make target. In\nthe case of per-package directories these header files are stored only\nin output/per-package/libbpf/.\n\nWhen output/per-package/bpftrace/ is populated, the content of\noutput/per-package/ from other packages overwrites the header files\ninstalled by libbpf because the list of rsync'ed packages is sorted\nalphabetically:\nhttps://gitlab.com/buildroot.org/buildroot/-/blob/2026.02.1/package/pkg-generic.mk#L796\n\nTo prevent this problem let libbpf install the updated kernel headers in\na new directory and add a configure option to bpftrace which is needed\nbecause pkgconf is not used to detect libbpf:\nhttps://github.com/bpftrace/bpftrace/blob/v0.25.1/cmake/FindLibBpf.cmake#L9\n\nPlease note that libbpf will add '/linux' to the path provided in\n$UAPIDIR:\nhttps://github.com/libbpf/libbpf/blob/v1.7.0/src/Makefile#L169\nso the headers end up in the previously non-existing directory\n$(STAGING_DIR)/usr/include/bpf/linux/:\n\n$ find output/per-package/libbpf/host/x86_64-buildroot-linux-gnu/sysroot/ -iname bpf.h -exec ls -lao {} \\;\n-rw-r--r-- 1 bernd 26434 25. Apr 13:15 output/per-package/libbpf/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/bpf/bpf.h\n-rw-r--r-- 1 bernd 283012 25. Apr 13:15 output/per-package/libbpf/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/bpf/linux/bpf.h\n-rw-r--r-- 12 bernd 160166 25. Apr 13:08 output/per-package/libbpf/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/linux/bpf.h\n\nbpf.h with 283012 bytes is the update-to-date version needed for bpftrace:\n\n$ grep -m1 bpf_iter_link_info output/per-package/libbpf/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/bpf/linux/bpf.h\nunion bpf_iter_link_info {\n$\n\n$ grep -m1 bpf_iter_link_info output/per-package/libbpf/host/x86_64-buildroot-linux-gnu/sysroot/usr/include/linux/bpf.h\n$\n\nBy adding '-I$(STAGING_DIR)/usr/include/bpf' to the CXXFLAGS of bpftrace\nits include finds the correct header:\nhttps://github.com/bpftrace/bpftrace/blob/v0.25.1/src/bpfprogram.cpp#L3\n\n  #include <linux/bpf.h>\n\nThe dpdk package uses pkgconf to detect libbpf and will use the updated\n.pc file:\nhttps://github.com/DPDK/dpdk/blob/v25.11/drivers/net/tap/bpf/meson.build#L7\n\nThe iproute2 package is not affected by the problem because it contains\n\"matching sanitized kernel headers\":\nhttps://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/README?h=v6.17.0#n44\n\nAs a host package pahole is also not affected.\n\nFixes:\nhttps://autobuild.buildroot.net/results/d8b/d8b416e40bf7bd019cd93e6f2d42c98fc12d4160/\n\nSigned-off-by: Bernd Kuhls <bernd@kuhls.net>\n---\n package/bpftrace/bpftrace.mk | 1 +\n package/libbpf/libbpf.mk     | 7 ++++++-\n 2 files changed, 7 insertions(+), 1 deletion(-)","diff":"diff --git a/package/bpftrace/bpftrace.mk b/package/bpftrace/bpftrace.mk\nindex 35c8dec29c..f530d4861b 100644\n--- a/package/bpftrace/bpftrace.mk\n+++ b/package/bpftrace/bpftrace.mk\n@@ -28,6 +28,7 @@ endif\n BPFTRACE_CONF_OPTS += \\\n \t-DBUILD_SHARED_LIBS:BOOL=OFF \\\n \t-DBUILD_TESTING:BOOL=OFF \\\n+\t-DCMAKE_CXX_FLAGS=\"$(TARGET_CXXFLAGS) -I$(STAGING_DIR)/usr/include/bpf\" \\\n \t-DENABLE_MAN:BOOL=OFF\n \n $(eval $(cmake-package))\ndiff --git a/package/libbpf/libbpf.mk b/package/libbpf/libbpf.mk\nindex 3a728867d8..65061a82bc 100644\n--- a/package/libbpf/libbpf.mk\n+++ b/package/libbpf/libbpf.mk\n@@ -25,9 +25,14 @@ endef\n # toolchain.\n # https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=a5cbe05a6673b85bed2a63ffcfea6a96c6410cff\n ifeq ($(BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_9),)\n-LIBBPF_UPDATE_UAPI_HEADERS = install_uapi_headers\n+LIBBPF_UPDATE_UAPI_HEADERS = install_uapi_headers UAPIDIR=/usr/include/bpf\n+LIBBPF_POST_INSTALL_STAGING_HOOKS += LIBBPF_FIX_STAGING_PC\n endif\n \n+define LIBBPF_FIX_STAGING_PC\n+\t$(SED) 's/-I$${includedir}/-I$${includedir}\\/bpf -I$${includedir}/' $(STAGING_DIR)/usr/lib/pkgconfig/libbpf.pc\n+endef\n+\n define LIBBPF_INSTALL_STAGING_CMDS\n \t$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) \\\n \t\t-C $(@D)/src install $(LIBBPF_UPDATE_UAPI_HEADERS) \\\n","prefixes":["3/8"]}