Andrii, I think that after this patch: commit 9eea8fafe33eb70868f6ace2fc1e17c4ff5539c3 Author: Andrii Nakryiko <andrii@xxxxxxxxxx> Date: Thu Jan 25 12:55:05 2024 -0800 libbpf: fix __arg_ctx type enforcement for perf_event programs Adjust PERF_EVENT type enforcement around __arg_ctx to match exactly what kernel is doing. Fixes: 76ec90a996e3 ("libbpf: warn on unexpected __arg_ctx type when rewriting BTF") Signed-off-by: Andrii Nakryiko <andrii@xxxxxxxxxx> Link: https://lore.kernel.org/r/20240125205510.3642094-3-andrii@xxxxxxxxxx Signed-off-by: Alexei Starovoitov <ast@xxxxxxxxxx I'm seeing: 19 5.42 debian:experimental-x-arm64 : FAIL gcc version 13.2.0 (Debian 13.2.0-12) from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:2:10: fatal error: ../../arch/arm64/include/uapi/asm/bpf_perf_event.h: No such file or directory 2 | #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. LD /tmp/build/perf/libperf/libperf-in.o LD /tmp/build/perf/libapi/libapi-in.o AR /tmp/build/perf/libperf/libperf.a AR /tmp/build/perf/libapi/libapi.a In file included from /git/perf-6.8.0/tools/include/uapi/linux/bpf_perf_event.h:11, from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:2:10: fatal error: ../../arch/arm64/include/uapi/asm/bpf_perf_event.h: No such file or directory 2 | #include "../../arch/arm64/include/uapi/asm/bpf_perf_event.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[4]: *** [/git/perf-6.8.0/tools/build/Makefile.build:105: /tmp/build/perf/libbpf/staticobjs/libbpf.o] Error 1 make[4]: *** Waiting for unfinished jobs.... LD /tmp/build/perf/libsubcmd/libsubcmd-in.o AR /tmp/build/perf/libsubcmd/libsubcmd.a make[3]: *** [Makefile:157: /tmp/build/perf/libbpf/staticobjs/libbpf-in.o] Error 2 44 4.47 ubuntu:18.04-x-riscv64 : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:8:10: fatal error: ../../arch/riscv/include/uapi/asm/bpf_perf_event.h: No such file or directory #include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. LD /tmp/build/perf/libapi/libapi-in.o AR /tmp/build/perf/libapi/libapi.a LD /tmp/build/perf/libperf/libperf-in.o AR /tmp/build/perf/libperf/libperf.a In file included from /git/perf-6.8.0/tools/include/uapi/linux/bpf_perf_event.h:11:0, from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:8:10: fatal error: ../../arch/riscv/include/uapi/asm/bpf_perf_event.h: No such file or directory #include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. /git/perf-6.8.0/tools/build/Makefile.build:105: recipe for target '/tmp/build/perf/libbpf/staticobjs/libbpf.o' failed make[4]: *** [/tmp/build/perf/libbpf/staticobjs/libbpf.o] Error 1 make[4]: *** Waiting for unfinished jobs.... LD /tmp/build/perf/libsubcmd/libsubcmd-in.o AR /tmp/build/perf/libsubcmd/libsubcmd.a 45 4.79 ubuntu:18.04-x-s390 : FAIL gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04) from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:6:10: fatal error: ../../arch/s390/include/uapi/asm/bpf_perf_event.h: No such file or directory #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. LD /tmp/build/perf/libapi/libapi-in.o LD /tmp/build/perf/libperf/libperf-in.o AR /tmp/build/perf/libperf/libperf.a AR /tmp/build/perf/libapi/libapi.a In file included from /git/perf-6.8.0/tools/include/uapi/linux/bpf_perf_event.h:11:0, from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:6:10: fatal error: ../../arch/s390/include/uapi/asm/bpf_perf_event.h: No such file or directory #include "../../arch/s390/include/uapi/asm/bpf_perf_event.h" ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. /git/perf-6.8.0/tools/build/Makefile.build:105: recipe for target '/tmp/build/perf/libbpf/staticobjs/libbpf.o' failed make[4]: *** [/tmp/build/perf/libbpf/staticobjs/libbpf.o] Error 1 make[4]: *** Waiting for unfinished jobs.... LD /tmp/build/perf/libsubcmd/libsubcmd-in.o AR /tmp/build/perf/libsubcmd/libsubcmd.a 51 4.78 ubuntu:22.04-x-riscv64 : FAIL gcc version 11.4.0 (Ubuntu 11.4.0-1ubuntu1~22.04) from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:8:10: fatal error: ../../arch/riscv/include/uapi/asm/bpf_perf_event.h: No such file or directory 8 | #include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. CC /tmp/build/perf/libbpf/staticobjs/usdt.o CC /tmp/build/perf/libbpf/staticobjs/zip.o CC /tmp/build/perf/libbpf/staticobjs/elf.o CC /tmp/build/perf/libbpf/staticobjs/features.o In file included from /git/perf-6.8.0/tools/include/uapi/linux/bpf_perf_event.h:11, from libbpf.c:37: /git/perf-6.8.0/tools/include/uapi/asm/bpf_perf_event.h:8:10: fatal error: ../../arch/riscv/include/uapi/asm/bpf_perf_event.h: No such file or directory 8 | #include "../../arch/riscv/include/uapi/asm/bpf_perf_event.h" | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. make[4]: *** [/git/perf-6.8.0/tools/build/Makefile.build:105: /tmp/build/perf/libbpf/staticobjs/libbpf.o] Error 1 make[4]: *** Waiting for unfinished jobs.... LD /tmp/build/perf/libsubcmd/libsubcmd-in.o AR /tmp/build/perf/libsubcmd/libsubcmd.a make[3]: *** [Makefile:157: /tmp/build/perf/libbpf/staticobjs/libbpf-in.o] Error 2 When building out of the kernel sources tree, i.e. when build perf from a tarball, which seems to indicate that tools/lib/bpf/libbpf.c is accessing out of tools/ files from the kernel. - Arnaldo