ebpf-summit-2020 icon indicating copy to clipboard operation
ebpf-summit-2020 copied to clipboard

compile failed

Open wbtlb opened this issue 4 years ago • 1 comments

Hi, could you please give some help for this problem skeleton/pid_iter.bpf.c:35:10: error: incomplete definition of type 'struct bpf_link' return BPF_CORE_READ((struct bpf_link *)ent, id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:257:3: note: expanded from macro 'BPF_CORE_READ' ___type((src), a, ##VA_ARGS) __r;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:181:29: note: expanded from macro '___type' #define ___type(...) typeof(___arrow(VA_ARGS)) ^~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:179:23: note: expanded from macro '___arrow' #define ___arrow(...) ___apply(___arrow, ___narg(VA_ARGS))(VA_ARGS) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 1 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:130:25: note: expanded from macro '___concat' #define ___concat(a, b) a ## b ^ :16:1: note: expanded from here ___arrow2 ^ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:170:26: note: expanded from macro '___arrow2' #define ___arrow2(a, b) a->b ~^ skeleton/pid_iter.bpf.c:35:32: note: forward declaration of 'struct bpf_link' return BPF_CORE_READ((struct bpf_link *)ent, id); ^ skeleton/pid_iter.bpf.c:35:10: error: incomplete definition of type 'struct bpf_link' return BPF_CORE_READ((struct bpf_link *)ent, id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:258:3: note: expanded from macro 'BPF_CORE_READ' BPF_CORE_READ_INTO(&__r, (src), a, ##VA_ARGS);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:220:3: note: expanded from macro 'BPF_CORE_READ_INTO' ___core_read(bpf_core_read, dst, (src), a, ##VA_ARGS)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:210:2: note: expanded from macro '___core_read' ___apply(___core_read, ___empty(VA_ARGS))(fn, dst,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: (skipping 3 expansions in backtrace; use -fmacro-backtrace-limit=0 to see all) /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:204:2: note: expanded from macro '___core_read0' ___read(fn, dst, ___type(src), src, a); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:184:59: note: expanded from macro '___read' read_fn((void )(dst), sizeof((dst)), &((src_type)(src))->accessor) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:119:56: note: expanded from macro 'bpf_core_read' (const void *)__builtin_preserve_access_index(src)) ^~~ skeleton/pid_iter.bpf.c:35:32: note: forward declaration of 'struct bpf_link' return BPF_CORE_READ((struct bpf_link *)ent, id); ^ skeleton/pid_iter.bpf.c:35:10: error: returning 'void' from a function with incompatible result type '__u32' (aka 'unsigned int') return BPF_CORE_READ((struct bpf_link *)ent, id); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /vagrant/linux-5.9.1/tools/lib/bpf/bpf_core_read.h:256:2: note: expanded from macro 'BPF_CORE_READ' ({
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ skeleton/pid_iter.bpf.c:42:17: warning: declaration of 'struct bpf_iter__task_file' will not be visible outside of this function [-Wvisibility] int iter(struct bpf_iter__task_file *ctx) ^ skeleton/pid_iter.bpf.c:44:25: error: incomplete definition of type 'struct bpf_iter__task_file' struct file *file = ctx->file; ~~~^ skeleton/pid_iter.bpf.c:42:17: note: forward declaration of 'struct bpf_iter__task_file' int iter(struct bpf_iter__task_file *ctx) ^ skeleton/pid_iter.bpf.c:45:32: error: incomplete definition of type 'struct bpf_iter__task_file' struct task_struct *task = ctx->task; ~~~^ skeleton/pid_iter.bpf.c:42:17: note: forward declaration of 'struct bpf_iter__task_file' int iter(struct bpf_iter__task_file *ctx) ^ skeleton/pid_iter.bpf.c:76:19: error: incomplete definition of type 'struct bpf_iter__task_file' bpf_seq_write(ctx->meta->seq, &e, sizeof(e)); ~~~^ skeleton/pid_iter.bpf.c:42:17: note: forward declaration of 'struct bpf_iter__task_file' int iter(struct bpf_iter__task_file *ctx) ^ 1 warning and 6 errors generated. make[1]: *** [Makefile:146: pid_iter.bpf.o] Error 1 make[1]: Leaving directory '/vagrant/linux-5.9.1/tools/bpf/bpftool' make: *** [Makefile:46: bpftool] Error 2

wbtlb avatar Feb 02 '21 03:02 wbtlb

Bumped into this for linux-5.16.1. The problem arises if you have;

Auto-detecting system features:
...               clang-bpf-co-re: [ on  ]

Do;

CLANG=Nope make -j8

and it builds fine.

uablrek avatar Jan 17 '22 09:01 uablrek