Search code examples
ubuntuebpfbpftrace

Install bpftrace on ubuntu


I am new at eBPF and i am following the bpftrace installing quide of https://github.com/iovisor/bpftrace. After cloning it and
mkdir bpftrace/build; cd bpftrace/build; I have executed build-libs.sh
~/bpftrace/build$ ../build-libs.sh So the script is unable to find the necessary files and directories to compile and install the BPFTrace libraries. The output of the last command execution is the following

~/bpftrace/build$ ../build-libs.sh   
+++ realpath ./build-libs.sh
++ dirname /home/me/bpftrace/build-libs.sh
+ BPFTRACE_DIR=/home/me/bpftrace
+ DESTDIR=/home/me/bpftrace/build-libs
+ mkdir -p /home/me/bpftrace/build-libs
+ [[ ! -n '' ]]
++ which gcc
+ [[ -n /usr/bin/gcc ]]
+ CC=gcc
++ nproc
+ make -C /home/me/bpftrace/libbpf/src -j4 CC=gcc OBJDIR=/home/me/bpftrace/build-libs PREFIX=/home/me/bpftrace/build-libs install install_uapi_headers
make: *** /home/me/bpftrace/libbpf/src: No such file or directory.  Stop.

Solution

  • pull the submodules step when Building bpftrace on Ubuntu

    git submodule init && git submodule update --recursive

    This will initialize the vendored libraries.