Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

67.10. bcc-0.37.0

The BPF Compiler Collection library, USDT probe support and the libbpf-tools tracers

Version 0.37.0, release 3
Shelf devtools — Debuggers, tracers, profilers, analysers, linters, language servers and developer utilities
Phase 40_lang (Languages), 18 of 186 in build order
Licence Apache-2.0 AND GPL-2.0-only AND GPL-3.0-only AND (LGPL-2.1-only OR BSD-2-Clause)
Homepage https://github.com/iovisor/bcc
Build time 0.6 SBU
Installed size 43.8 MiB in 583 files
Recipe ports/core/devtools/bcc/kpkgbuild

About

The BPF Compiler Collection: libbcc, a library that compiles a BPF program from C with clang and loads it into the kernel, with USDT (user-level statically defined tracing) probe support; its Python module and the Python tools that use it, under /usr/share/bcc/tools; and the libbpf-tools, compiled CO-RE tracers such as execsnoop, opensnoop and biolatency, installed as bpf-<tool> in /usr/bin. bpftrace is the reason for the port: its find_package(LibBcc REQUIRED) is unconditional.

The source is upstream’s bcc-src-with-submodule release asset, not the tag archive. bcc carries libbpf, bpftool and blazesym as git submodules, which a tag archive leaves as empty directories.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, flex, bison, python3, llvm, clang, elfutils, zlib, xz, libbpf, bpftool, argp-standalone.

Required by (1): bpftrace.

Optional, off in KDOS

These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.

Patches

build.sh applies these; kpkg applies nothing by itself.

Installation

From the repository root, inside the build container, this is the line kdosbuild runs for the port:

script/chroot/exec.sh bash -c 'source script/phases/40_lang/phase.env && kpkg install bcc'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/devtools/bcc.

1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.

cd /ports/core/devtools/bcc
echo '7734b780202b22dff335780b506b56833ec6cf7435e03b1346d5bf644b4e1f95  bcc-0.37.0.tar.gz' | sha256sum -c -

2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.

SRC_ROOT=/var/cache/kpkg/work/bcc
SRC=$SRC_ROOT/bcc-0.37.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf bcc-0.37.0.tar.gz -C "$SRC" --strip-components=1

Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.

3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

cd bcc

patch -p1 -i $PORT_SRC/llvm23-mccontext.patch

_clang=/usr/lib/libclang-cpp.so
_clang_libs=()
for _c in Analysis AST Basic CodeGen Driver Edit Frontend Lex Parse Rewrite Sema \
	Serialization ASTMatchers Support APINotes; do
	_clang_libs+=("-Dlibclang$_c=$_clang")
done

mkdir -p build && cd build
cmake .. -G Ninja \
	-DREVISION=$version \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DCMAKE_USE_LIBBPF_PACKAGE=ON \
	-DENABLE_LLVM_SHARED=OFF \
	"${_clang_libs[@]}" \
	-DENABLE_CLANG_JIT=ON \
	-DENABLE_LIBDEBUGINFOD=OFF \
	-DCMAKE_DISABLE_FIND_PACKAGE_LibDebuginfod=TRUE \
	-DCMAKE_DISABLE_FIND_PACKAGE_LuaJIT=TRUE \
	-DENABLE_MAN=ON \
	-DENABLE_EXAMPLES=OFF \
	-DENABLE_TESTS=OFF \
	-DENABLE_USDT=ON \
	-DPYTHON_CMD=python3
ninja
DESTDIR=$PKG ninja install
if ldd "$PKG/usr/lib/libbcc.so.0" 2>&1 | grep 'symbol not found'; then
	echo 'bcc: libbcc.so.0 does not resolve against the installed clang and LLVM' >&2
	exit 1
fi

export EXTRA_LDFLAGS=-largp
_mk=(USE_BLAZESYM=0 BPFTOOL=/usr/sbin/bpftool prefix=/usr APP_PREFIX=bpf-
	CFLAGS="$CFLAGS -Wno-error=missing-field-initializers")
make -C ../libbpf-tools "${_mk[@]}"
make -C ../libbpf-tools "${_mk[@]}" DESTDIR=$PKG install

install -Dm644 ../LICENSE.txt "$PKG/usr/share/licenses/$name/LICENSE.txt"
install -Dm644 ../libbpf-tools/bpftool/LICENSE.GPL-2.0 \
	"$PKG/usr/share/licenses/$name/libbpf-tools/LICENSE.GPL-2.0"
install -Dm644 /usr/share/licenses/bison/COPYING \
	"$PKG/usr/share/licenses/$name/libbpf-tools/LICENSE.GPL-3.0"
install -Dm644 -t "$PKG/usr/share/licenses/$name/libbpf" \
	../src/cc/libbpf/LICENSE ../src/cc/libbpf/LICENSE.BSD-2-Clause ../src/cc/libbpf/LICENSE.LGPL-2.1

The switches, and why each is set:

The common switches of each build system are explained in the Flag glossary.

4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/bcc, prunes what the image does not ship, lints the tree and rolls it reproducibly:

tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
    --mtime=@$SOURCE_DATE_EPOCH \
    --use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
    -cf bcc-0.37.0-3.tar.xz -C "$PKG" .

5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/bcc, and runs the triggers its paths call for.

Contents

Installed programs: bpf-bashreadline, bpf-bcachefsdist, bpf-bcachefsslower, bpf-bindsnoop, bpf-biolatency, bpf-biopattern, bpf-biosnoop, bpf-biostacks, bpf-biotop, bpf-bitesize, bpf-btrfsdist, bpf-btrfsslower, bpf-cachestat, bpf-capable, bpf-cpudist, bpf-cpufreq, bpf-drsnoop, bpf-execsnoop, bpf-exitsnoop, bpf-ext4dist, bpf-ext4slower, bpf-f2fsdist, bpf-f2fsslower, bpf-filelife, bpf-filetop, bpf-fsdist, bpf-fsslower, bpf-funclatency, bpf-fusedist, bpf-fuseslower, bpf-futexctn, bpf-gethostlatency, bpf-hardirqs, bpf-javagc, bpf-killsnoop, bpf-klockstat, bpf-ksnoop, bpf-llcstat, bpf-mdflush, bpf-memleak, bpf-mountsnoop, bpf-nfsdist, bpf-nfsslower, bpf-numamove, bpf-offcputime, bpf-oomkill, bpf-opensnoop, bpf-profile, bpf-readahead, bpf-runqlat, bpf-runqlen, bpf-runqslower, bpf-sigsnoop, bpf-slabratetop, bpf-softirqs, bpf-solisten, bpf-statsnoop, bpf-syncsnoop, bpf-syscount, bpf-tcpconnect, bpf-tcpconnlat, bpf-tcplife, bpf-tcppktlat, bpf-tcprtt, bpf-tcpstates, bpf-tcpsynbl, bpf-tcptop, bpf-tcptracer, bpf-vfsstat, bpf-wakeuptime, bpf-xfsdist, bpf-xfsslower, bpf-zfsdist, bpf-zfsslower.

Installed libraries: libbcc-loader-static.a, libbcc.a, libbcc.so, libbcc_bpf.a, libbcc_bpf.so.

Installed directories: /usr/include/bcc, /usr/lib/python3.14/site-packages/bcc, /usr/lib/python3.14/site-packages/bcc-0.37.0-py3.14.egg-info, /usr/share/bcc, /usr/share/licenses/bcc.

Short descriptions

libbcc.pc BCC Program library

Notes

The libbpf-tools are a separate Makefile outside the CMake build, run with make -C ../libbpf-tools from the CMake build directory. Each tool links a static libbpf the Makefile builds from the submodule’s sources, which is a copy inside that executable and not a second libbpf in any process that loads the shared one. The tools carry vmlinux.h per architecture in the source, so nothing is read from the build machine’s kernel.

/usr/share/licenses/bcc holds bcc’s Apache-2.0 text and, because the libbpf-tools are licensed apart from it, the texts they ship under: libbpf/ for the static libbpf in every tool (LGPL-2.1 OR BSD-2-Clause), libbpf-tools/LICENSE.GPL-2.0, taken from the bpftool submodule, for the tools under GPL-2.0, and libbpf-tools/LICENSE.GPL-3.0 for bpf-wakeuptime, whose BPF program wakeuptime.bpf.c is GPL-3.0. The source carries no GPL-3.0 text, so that one is bison’s COPYING, a full GPL version 3 text that the bison package, a build dependency, installs as /usr/share/licenses/bison/COPYING in the build root. The license key names all four.