libbpf / libbpf-bootstrap

Scaffolding for BPF application development with libbpf and BPF CO-RE
BSD 3-Clause "New" or "Revised" License
1.06k stars 289 forks source link

I can make minimal,but can't make bpftool,why? #286

Open Ruid6 opened 3 weeks ago

Ruid6 commented 3 weeks ago

Ubuntu 22.04 LTS:6.8.0-40-generic

I've read the Readme

apt install clang libelf1 libelf-dev zlib1g-dev
git clone --recurse-submodules https://github.com/libbpf/libbpf-bootstrap
git submodule update --init --recursive
cd examples/c
make

OUTPUT:

MKDIR .output MKDIR .output/libbpf LIB libbpf.a make[1]: pkg-config: 没有那个文件或目录 MKDIR /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/bpf.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/btf.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/libbpf.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/libbpf_errno.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/netlink.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/nlattr.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/str_error.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/libbpf_probes.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/bpf_prog_linfo.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/btf_dump.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/hashmap.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/ringbuf.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/strset.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/linker.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/gen_loader.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/relo_core.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/usdt.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/zip.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/elf.o CC /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/staticobjs/features.o AR /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/libbpf.a 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 /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/libbpf.pc INSTALL /home/ruid/libbpf-bootstrap/examples/c/.output//libbpf/libbpf.a MKDIR bpftool BPFTOOL bpftool/bootstrap/bpftool ... libbfd: [ OFF ] ... clang-bpf-co-re: [ on ] ... llvm: [ OFF ] ... libcap: [ OFF ] MKDIR /home/ruid/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/libbpf/include/bpf INSTALL /home/ruid/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/libbpf/include/bpf/hashmap.h INSTALL /home/ruid/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/libbpf/include/bpf/relo_core.h INSTALL /home/ruid/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/libbpf/include/bpf/libbpf_internal.h MKDIR /home/ruid/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/ MKDIR /home/ruid/libbpf-bootstrap/examples/c/.output/bpftool/bootstrap/libbpf/ make[2]: pkg-config: 没有那个文件或目录 ......

But, sudo ./bootstrap work successfully. Than , cd bpftool/src &&make

... libbfd: [ OFF ] ... clang-bpf-co-re: [ on ] ... llvm: [ OFF ] ... libcap: [ OFF ] GEN pid_iter.skel.h CC pids.o CLANG profiler.bpf.o make: llvm-strip: 没有那个文件或目录 make: *** [Makefile:209:profiler.bpf.o] 错误 127

What's wrong with me?

anakryiko commented 3 weeks ago

Nothing is wrong with you :) full-blown bpftool expects llvm-strip (for no good reason, anymore), so make sure you have that tool available.

cc @qmonnet, it would be nice to remove llvm-strip, bpftool gen object strips out DWARF already, so you shouldn't need extra stripping.

qmonnet commented 3 weeks ago

Hey! I can't even remember why we have it. Looking at the logs, you added it in torvalds/linux@f3c93a93b564d25cab715cd71a6c3417e77b19f3, but if now we strip it already then I guess the command brings nothing and yes, I'll remove it (give me a few days)

qmonnet commented 6 days ago

The llvm-strip pass was removed in bpf-next's bpftool, the patch will land in the GH repo at the next sync. https://lore.kernel.org/all/20240924165202.1379930-1-chen.dylane@gmail.com/t/#m2c7d090d88b405495d05b0f3d191a9afe76bb49e