bpftrace: 0.23.5 -> 0.24.1

This fixes build error due to updaded llvm.

bpftrace 0.24.1 had a couple of regressions, so backport fix and
temporarily raise ulimit in test.
A better solution for ulimit will probably make it in 0.24.2 but
that is likely harmless enough in practice so go ahead as is.

Notes:
- add new xxd build dep to fix build
- INSTALL_TOOL_DOCS was removed, .txt files are now comments in scripts
  themselves
- USE_SYSTEM_LIBBPF is optional right now but needed on master, just set
  it as there is no harm and next auto-update will be less work
This commit is contained in:
Dominique Martinet
2025-10-10 06:18:14 +09:00
parent c9b6fb7985
commit 27bb09b95e
2 changed files with 22 additions and 5 deletions

View File

@@ -21,7 +21,12 @@
# simple BEGIN probe (user probe on bpftrace itself)
print(machine.succeed("bpftrace -e 'BEGIN { print(\"ok\\n\"); exit(); }'"))
# tracepoint
print(machine.succeed("bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'"))
# workaround: this needs more than the default of 1k FD to attach ~350 probes, bump fd limit
# see https://github.com/bpftrace/bpftrace/issues/2110
print(machine.succeed("""
ulimit -n 2048
bpftrace -e 'tracepoint:syscalls:sys_enter_* { print(probe); exit() }'
"""))
# kprobe
print(machine.succeed("bpftrace -e 'kprobe:schedule { print(probe); exit() }'"))
# BTF

View File

@@ -2,6 +2,7 @@
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
llvmPackages,
elfutils,
bcc,
@@ -16,20 +17,30 @@
flex,
bison,
util-linux,
xxd,
nixosTests,
}:
stdenv.mkDerivation rec {
pname = "bpftrace";
version = "0.23.5";
version = "0.24.1";
src = fetchFromGitHub {
owner = "bpftrace";
repo = "bpftrace";
rev = "v${version}";
hash = "sha256-Shtf4PSXxUV0Bd7ORYyP06lbWf3LE6BQi7WfTIGDOfk=";
hash = "sha256-Wt1MXKOg48477HMszq1GAjs+ZELbfAfp+P2AYa+dg+Q=";
};
patches = [
(fetchpatch {
name = "attach_tracepoint_with_enums.patch";
url = "https://github.com/bpftrace/bpftrace/pull/4714.patch";
includes = [ "src/ast/passes/clang_parser.cpp" ];
hash = "sha256-xk+/eBNJJJSUqNTs0HFr0BAaqRB5B7CNWRSmnoBMTs0=";
})
];
buildInputs = with llvmPackages; [
llvm
libclang
@@ -49,11 +60,12 @@ stdenv.mkDerivation rec {
bison
llvmPackages.llvm.dev
util-linux
xxd
];
cmakeFlags = [
"-DLIBBCC_INCLUDE_DIRS=${bcc}/include"
"-DINSTALL_TOOL_DOCS=OFF"
"-DUSE_SYSTEM_LIBBPF=ON"
"-DSYSTEM_INCLUDE_PATHS=${glibc.dev}/include"
];
@@ -72,7 +84,7 @@ stdenv.mkDerivation rec {
];
passthru.tests = {
bpf = nixosTests.bpf;
inherit (nixosTests) bpf;
};
meta = {