summary refs log tree commit diff
path: root/pkgs/os-specific/linux/bpftrace
diff options
context:
space:
mode:
authorDominique Martinet <asmadeus@codewreck.org>2021-12-04 21:54:07 +0900
committerDominique Martinet <asmadeus@codewreck.org>2021-12-06 07:15:56 +0900
commitfa857bb4357937a20675ae1ef49cf37e54e2f20c (patch)
treee9c34a01d598b7e5ef11343f46828a9f607aa679 /pkgs/os-specific/linux/bpftrace
parent559fe436657bf68f83718548c02cdcd6e93e6add (diff)
downloadnixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.tar
nixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.tar.gz
nixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.tar.bz2
nixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.tar.lz
nixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.tar.xz
nixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.tar.zst
nixpkgs-fa857bb4357937a20675ae1ef49cf37e54e2f20c.zip
bpftrace: fix build with libbpf 0.6.0
libbpf 0.6.0 relies on typeof in bpf/btf.h to pick the right version of
btf_dump__new() but that's not valid c++.
see https://github.com/iovisor/bpftrace/issues/2068
Diffstat (limited to 'pkgs/os-specific/linux/bpftrace')
-rw-r--r--pkgs/os-specific/linux/bpftrace/btf-dump-new-0.6.0.patch39
-rw-r--r--pkgs/os-specific/linux/bpftrace/default.nix5
2 files changed, 44 insertions, 0 deletions
diff --git a/pkgs/os-specific/linux/bpftrace/btf-dump-new-0.6.0.patch b/pkgs/os-specific/linux/bpftrace/btf-dump-new-0.6.0.patch
new file mode 100644
index 00000000000..b5037192203
--- /dev/null
+++ b/pkgs/os-specific/linux/bpftrace/btf-dump-new-0.6.0.patch
@@ -0,0 +1,39 @@
+diff -ur source/src/btf.cpp new/src/btf.cpp
+--- source/src/btf.cpp	1970-01-01 09:00:01.000000000 +0900
++++ new/src/btf.cpp	2021-12-04 21:46:59.337023489 +0900
+@@ -225,7 +225,7 @@
+   char err_buf[256];
+   int err;
+ 
+-  dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
++  dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
+   err = libbpf_get_error(dump);
+   if (err)
+   {
+@@ -496,7 +496,7 @@
+   char err_buf[256];
+   int err;
+ 
+-  dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
++  dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
+   err = libbpf_get_error(dump);
+   if (err)
+   {
+@@ -554,7 +554,7 @@
+   char err_buf[256];
+   int err;
+ 
+-  dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
++  dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
+   err = libbpf_get_error(dump);
+   if (err)
+   {
+@@ -648,7 +648,7 @@
+   char err_buf[256];
+   int err;
+ 
+-  dump = btf_dump__new(btf, nullptr, &opts, dump_printf);
++  dump = btf_dump__new_deprecated(btf, nullptr, &opts, dump_printf);
+   err = libbpf_get_error(dump);
+   if (err)
+   {
diff --git a/pkgs/os-specific/linux/bpftrace/default.nix b/pkgs/os-specific/linux/bpftrace/default.nix
index b69514e8080..9a197b4c78c 100644
--- a/pkgs/os-specific/linux/bpftrace/default.nix
+++ b/pkgs/os-specific/linux/bpftrace/default.nix
@@ -17,6 +17,11 @@ stdenv.mkDerivation rec {
     sha256 = "sha256-rlaajNfpoiMtU/4aNAnbQ0VixPz9/302TZMarGzsb58=";
   };
 
+  # libbpf 0.6.0 relies on typeof in bpf/btf.h to pick the right version of
+  # btf_dump__new() but that's not valid c++.
+  # see https://github.com/iovisor/bpftrace/issues/2068
+  patches = [ ./btf-dump-new-0.6.0.patch ];
+
   buildInputs = with llvmPackages;
     [ llvm libclang
       elfutils libelf bcc