bpf/bpf.h: No such file or directory

git clone --depth 1 https://github.com/libbpf/libbpf
cd src
sudo make install
[root@junqiang src]# make install
  INSTALL  bpf.h libbpf.h btf.h libbpf_common.h libbpf_legacy.h bpf_helpers.h bpf_helper_defs.h bpf_tracing.h bpf_endian.h bpf_core_read.h skel_internal.h libbpf_version.h usdt.bpf.h
  INSTALL  ./libbpf.pc
  INSTALL  ./libbpf.a ./libbpf.so ./libbpf.so.1 ./libbpf.so.1.0.0

 还有个方法:

[root@junqiang bpf]# pwd
/usr/src/kernels/4.19.100/tools/lib/bpf
[root@junqiang bpf]# make
Auto-detecting system features:
...                        libelf: [ on  ]
...                           bpf: [ on  ]
Warning: Kernel ABI header at 'tools/include/uapi/linux/bpf.h' differs from latest version at 'include/uapi/linux/bpf.h'
  CC       libbpf.o
  CC       bpf.o
  CC       nlattr.o
  CC       btf.o
  CC       libbpf_errno.o
  CC       str_error.o
  LD       libbpf-in.o
  LINK     libbpf.a
  LINK     libbpf.so

最后把lib及头文件放到相应的位置

 

posted @ 2022-09-16 23:38  salami_china  阅读(1583)  评论(0编辑  收藏  举报