package/linux-tools: perf: explicitly disable BPF skeletons
PATCH 1/1 package/linux-tools: perf: explicitly disable BPF skeletons
From: Yegor Yefremov <[email protected]>
perf builds its BPF skeletons by default whenever libelf, zlib, libbpf and openssl support are enabled and a clang >= 12.0.1 is found in the PATH. That clang is the host's one, and it compiles the BPF programs against the host's system headers, so the build fails (here with linux 7.2.6 on ARM and Ubuntu's clang 21.1.8):
/usr/include/linux/ioctl.h:5:10: fatal error: 'asm/ioctl.h' file not found
make[6]: *** [.../tools/perf/bpf_skel.mak:87: .../tools/perf/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1
Without clang on the host, perf silently disables them, so whether the build works depends on the build machine.
The perf tool does not depend on host-clang, so always pass BUILD_BPF_SKEL=0 rather than let the host's clang be picked up.
--- package/linux-tools/linux-tool-perf.mk.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
package/linux-tools/linux-tool-perf.mk.in +2 -1
@@ -30,7 +30,8 @@ PERF_MAKE_FLAGS = \ NO_LIBPYTHON=1 \ NO_LIBBIONIC=1 \ NO_RUST=1 \ - NO_SHELLCHECK=1 + NO_SHELLCHECK=1 \ + BUILD_BPF_SKEL=0 # We need to pass an argument to ld for setting the emulation when # building for MIPS architecture, otherwise the default one will always
Signature · 6 lines
2.55.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Thomas Petazzoni via buildroot
AppliedQuoted 11 lines · Yegor Yefremov via buildroot
From: Yegor Yefremov <[email protected]>
perf builds its BPF skeletons by default whenever libelf, zlib, libbpf and openssl support are enabled and a clang >= 12.0.1 is found in the PATH. That clang is the host's one, and it compiles the BPF programs against the host's system headers, so the build fails (here with linux 7.2.6 on ARM and Ubuntu's clang 21.1.8):
/usr/include/linux/ioctl.h:5:10: fatal error: 'asm/ioctl.h' file not found
make[6]: *** [.../tools/perf/bpf_skel.mak:87:.../tools/perf/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1
Quoted 7 lines
Without clang on the host, perf silently disables them, so whether the build works depends on the build machine.
The perf tool does not depend on host-clang, so always pass BUILD_BPF_SKEL=0 rather than let the host's clang be picked up.
Signed-off-by Yegor Yefremov <[email protected]>
Applied to master, thanks!
Best regards,
Thomas Petazzoni
Signature · 7 lines
Thomas Petazzoni, co-owner and CEO, Bootlin Embedded Linux and Kernel engineering and training https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Raphaël Mélotte via buildroot
AppliedIn reply of:
Quoted 9 lines
perf builds its BPF skeletons by default whenever libelf, zlib, libbpf and openssl support are enabled and a clang >= 12.0.1 is found in the PATH. That clang is the host's one, and it compiles the BPF programs against the host's system headers, so the build fails (here with linux 7.2.6 on ARM and Ubuntu's clang 21.1.8):
/usr/include/linux/ioctl.h:5:10: fatal error: 'asm/ioctl.h' file not found
make[6]: *** [.../tools/perf/bpf_skel.mak:87:.../tools/perf/util/bpf_skel/.tmp/bpf_prog_profiler.bpf.o] Error 1
Quoted 7 lines
Without clang on the host, perf silently disables them, so whether the build works depends on the build machine.
The perf tool does not depend on host-clang, so always pass BUILD_BPF_SKEL=0 rather than let the host's clang be picked up.
Signed-off-by Yegor Yefremov <[email protected]>
Applied to 2025.02.x, 2026.08.x. Thanks
Quoted 9 lines
--- package/linux-tools/linux-tool-perf.mk.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)package/linux-tools/linux-tool-perf.mk.in +0
-0
package/linux-tools/linux-tool-perf.mk.in PERF_MAKE_FLAGS = \ · line 37
Quoted 9 lines
package/linux-tools/linux-tool-perf.mk.in +2
-1@@ -30,7 +30,8 @@ PERF_MAKE_FLAGS = \ NO_LIBPYTHON=1 \ NO_LIBBIONIC=1 \ NO_RUST=1 \ - NO_SHELLCHECK=1 + NO_SHELLCHECK=1 \ + BUILD_BPF_SKEL=0 # We need to pass an argument to ld for setting the emulation when # building for MIPS architecture, otherwise the default one will always
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Hello Yegor, all,
Quoted 2 lines · Yegor Yefremov via buildroot
The perf tool does not depend on host-clang, so always pass BUILD_BPF_SKEL=0 rather than let the host's clang be picked up.
This breaks perf on kernels up to 6.6, e.g. linux 6.1 without a host clang:
Makefile.config:705: *** Error: clang too old/not installed. Please install recent clang to build with BUILD_BPF_SKEL. Stop.
Up to 6.6 (still in the latest 5.15, 6.1 and 6.6 LTS releases), perf tests "ifdef BUILD_BPF_SKEL", so =0 enables the skeletons. Only since 6.7 do they default to on, and =0 disables them.
Our temporary workaround passes BUILD_BPF_SKEL=0 only to the newer kernels, and an empty value, which ifdef treats as undefined, to the older ones:
PERF_MAKE_FLAGS += \ BUILD_BPF_SKEL=$$(grep -qs '^ifndef BUILD_BPF_SKEL' \ $(LINUX_DIR)/tools/perf/Makefile.config && echo 0)
Best regards,
Pieterjan
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot