Skip to content

Commit f7c4e85

Browse files
liu-song-6acmel
authored andcommitted
perf bpf: Fix building perf with BUILD_BPF_SKEL=1 by default in more distros
Arnaldo reported that building all his containers with BUILD_BPF_SKEL=1 to then make this the default he found problems in some distros where the system linux/bpf.h file was being used and lacked this: util/bpf_skel/bperf_leader.bpf.c:13:20: error: use of undeclared identifier 'BPF_F_PRESERVE_ELEMS' __uint(map_flags, BPF_F_PRESERVE_ELEMS); So use instead the vmlinux.h file generated by bpftool from BTF info. This fixed these as well, getting the build back working on debian:11, debian:experimental and ubuntu:21.10: In file included from In file included from util/bpf_skel/bperf_leader.bpf.cutil/bpf_skel/bpf_prog_profiler.bpf.c::33: : In file included from In file included from /usr/include/linux/bpf.h/usr/include/linux/bpf.h::1111: : /usr/include/linux/types.h/usr/include/linux/types.h::55::1010:: In file included from util/bpf_skel/bperf_follower.bpf.c:3fatal errorfatal error: : : In file included from /usr/include/linux/bpf.h:'asm/types.h' file not found11'asm/types.h' file not found: /usr/include/linux/types.h:5:10: fatal error: 'asm/types.h' file not found #include <asm/types.h>#include <asm/types.h> ^~~~~~~~~~~~~ ^~~~~~~~~~~~~ #include <asm/types.h> ^~~~~~~~~~~~~ 1 error generated. Reported-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: Song Liu <[email protected]> Tested-by: Athira Rajeev <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Link: http://lore.kernel.org/lkml/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 4747395 commit f7c4e85

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

tools/perf/util/bpf_skel/bperf_follower.bpf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
22
// Copyright (c) 2021 Facebook
3-
#include <linux/bpf.h>
4-
#include <linux/perf_event.h>
3+
#include "vmlinux.h"
54
#include <bpf/bpf_helpers.h>
65
#include <bpf/bpf_tracing.h>
76
#include "bperf.h"

tools/perf/util/bpf_skel/bperf_leader.bpf.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
22
// Copyright (c) 2021 Facebook
3-
#include <linux/bpf.h>
4-
#include <linux/perf_event.h>
3+
#include "vmlinux.h"
54
#include <bpf/bpf_helpers.h>
65
#include <bpf/bpf_tracing.h>
76
#include "bperf.h"

tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
22
// Copyright (c) 2020 Facebook
3-
#include <linux/bpf.h>
3+
#include "vmlinux.h"
44
#include <bpf/bpf_helpers.h>
55
#include <bpf/bpf_tracing.h>
66

0 commit comments

Comments
 (0)