Skip to content

Build, Testing, and Release

Build and Bytecode Assets ​

Build host and target architecture ​

Run the collector build on Linux, including builds for Android. v2.12.0 uses Go 1.26.0 or newer, GNU Make, a C toolchain, Clang/LLVM, bpftool, kernel headers and the recursive lib/libpcap submodule. In the upstream collector checkout, prepare the environment with bash builder/init_env.sh and apply the exports it prints. TARGET_ARCH selects the artifact architecture. With no selection the default is native. CROSS_ARCH remains a compatibility input when TARGET_ARCH is unset.

TargetMaintained toolchain / builderRuntime
amd64 and arm64Release/PR packaging uses Ubuntu 24.04, LLVM 14 for BPF and the matching native or cross C toolchain.Linux and Android. Minimum kernels are 4.18 for x86_64 and 5.5 for arm64.
loong64Cross-build on Ubuntu 24.04 x86_64 or build natively on Debian 13+. Both use LLVM/Clang/LLD 22.1.8, a LoongArch64 LP64D toolchain and the matching target libraries.Linux loongarch64, kernel 6.6+.

For cross-builds, prepare the target kernel headers and configuration and point KERN_HEADERS at that tree. Native non-CO-RE builds normally use the running kernel's build/source tree. LoongArch CO-RE requires target BTF to generate its vmlinux.h. Toolchain and recipes · Architecture selection · LoongArch details

From C objects to the executable ​

text
kern/*.c
  -> .build/<target>-<goarch>/bytecode/*_kern_{core,noncore}.o
  -> assets/ebpf_probe_<target>_<goarch>_bindata.go
  -> .build/<target>-<goarch>/bin/ecapture
  -> bin/ecapture

make core embeds only CO-RE objects, make nocore only non-CO-RE objects, and make all includes both. CO-RE uses type information for relocation. The non-CO-RE recipe compiles against prepared kernel headers, including handling for Linux 6.19+ anonymous fields and Linux 7.x x86 headers. Both recipes strip DWARF with llvm-strip -g and retain BTF. The runtime selector matches the requested BTF mode to the objects present in the resulting binary. Object recipes · Runtime selector

Run the native build in the prepared Linux checkout.

sh
git submodule update --init --recursive
make clean
make env
make all
file bin/ecapture

The Makefile builds libpcap for the selected target and links it through CGO. An ebpfassets build uses generated assets, and ecap_android selects the Android module set. A plain Go build can select the asset stub, which cannot load a probe. The final link verifies static PIE, no ELF interpreter and no shared-library dependencies before copying the executable to bin/ecapture. Go build and link checks · Build tags and production verification

Build and Bytecode Assets has loaded

Released under the MIT License.