Last active
April 5, 2016 22:02
-
-
Save cransom/a908b2405a0518ddebf8d48d3bab26ec to your computer and use it in GitHub Desktop.
bundling bcc in nixos
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ pkgs | |
, linux | |
, clang | |
, cmake | |
, llvm | |
, bison | |
, flex | |
, iperf | |
, python | |
, llvmPackages | |
, clangStdenv | |
, makeWrapper | |
, ... | |
}: | |
clangStdenv.mkDerivation rec { | |
name = "bcc"; | |
kernel = linux; | |
version = "bleeding"; | |
src = pkgs.fetchgit { | |
url = https://github.com/iovisor/bcc.git; | |
rev = "31571b4f98e9adb27f91b26cdc44f3fa8b2dcfc2"; | |
sha256 = "18xb0m7bk2zzpsdl4y42z2qkkynqp43kn0j8ql24cmirk5yf6pi3"; | |
}; | |
cmakeFlags = "-DBCC_KERNEL_HAS_SOURCE_DIR=1"; | |
postPatch = '' | |
substituteInPlace src/cc/frontends/clang/kbuild_helper.h --replace "/lib/modules" "${kernel.dev}/lib/modules" | |
''; | |
postInstall = '' | |
mkdir $out/bin | |
cp $out/share/bcc/tools/* $out/bin/ || true | |
for f in $out/bin/*; do | |
wrapProgram $f \ | |
--prefix PYTHONPATH : $out/lib/python2.7/site-packages \ | |
--prefix LD_LIBRARY_PATH : $out/lib | |
done | |
''; | |
enableParallelBuilding = true; | |
nativeBuildInputs = [ clang cmake llvm bison flex iperf python llvmPackages.clang-unwrapped makeWrapper]; | |
propagatedBuildInputs = [ clang cmake llvm bison flex iperf python llvmPackages.clang-unwrapped ]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0ogre:~/git/root/services/pipeline% sudo result/bin/opensnoop [pipeline:bcc] | |
In file included from <built-in>:316: | |
In file included from <command line>:7: | |
/virtual/include/bcc/helpers.h:25:2: error: "CONFIG_BPF_SYSCALL is undefined, please check your .config or ask your Linux distro to enable this feature" | |
#error "CONFIG_BPF_SYSCALL is undefined, please check your .config or ask your Linux distro to enable this feature" | |
^ | |
1 error generated. | |
Traceback (most recent call last): | |
File "/nix/store/9sjidfywi5v9djy08mldw53fx2b8gfnx-bcc/bin/.opensnoop-wrapped", line 81, in <module> | |
b = BPF(text=bpf_text) | |
File "/nix/store/9sjidfywi5v9djy08mldw53fx2b8gfnx-bcc/lib/python2.7/site-packages/bcc/__init__.py", line 165, in __init__ | |
raise Exception("Failed to compile BPF module %s" % src_file) | |
Exception: Failed to compile BPF module | |
1ogre:~/git/root/services/pipeline% zgrep CONFIG_BPF_SYSCALL /proc/config.gz [pipeline:bcc] | |
CONFIG_BPF_SYSCALL=y |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment