1

I am writing an eBPF Code. I need to use the function bpf_obj_pin, declared in kernel files:

  • tools/lib/bpf/bpf.c
  • tools/lib/bpf/bpf.h

Refer from here: https://elixir.bootlin.com/linux/latest/ident/bpf_obj_pin

So from the same files, I found out that I had to include this in my header.

#include <bpf/bpf.h>

But I get the following ERROR:

clang -O2 -target bpf -I/usr/include/x86_64-linux-gnu -c bpf1.c -o bpf1.o
bpf1.c:10:10: fatal error: 'bpf/bpf.h' file not found
#include <bpf/bpf.h>
         ^~~~~~~~~~~
1 error generated.
makefile:21: recipe for target 'bpf1.o' failed
make: *** [bpf1.o] Error 1
  • This is somewhat similar but doesn't solve my problem.

0 Answers0