1 { lib, stdenv, fetchFromGitHub, fetchpatch
2 , cmake, libpfm, zlib, pkg-config, python3Packages, which, procps, gdb, capnproto
5 stdenv.mkDerivation rec {
9 src = fetchFromGitHub {
13 sha256 = "H39HPkAQGubXVQV3jCpH4Pz+7Q9n03PrS70utk7Tt2k=";
18 name = "fix-flexible-array-member.patch";
19 url = "https://github.com/rr-debugger/rr/commit/2979c60ef8bbf7c940afd90172ddc5d8863f766e.diff";
20 sha256 = "cmdCJetQr3ELPOyWl37h1fGfG/xvaiJpywxIAnqb5YY=";
25 substituteInPlace src/Command.cc --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
26 sed '7i#include <math.h>' -i src/Scheduler.cc
30 # With LTO enabled, linking fails with the following message:
32 # src/AddressSpace.cc:1666: undefined reference to `rr_syscall_addr'
33 # ld.bfd: bin/rr: hidden symbol `rr_syscall_addr' isn't defined
34 # ld.bfd: final link failed: bad value
35 # collect2: error: ld returned 1 exit status
37 # See also https://github.com/NixOS/nixpkgs/pull/110846
38 preConfigure = ''substituteInPlace CMakeLists.txt --replace "-flto" ""'';
40 nativeBuildInputs = [ cmake pkg-config which ];
42 libpfm zlib python3Packages.python python3Packages.pexpect procps gdb capnproto
44 propagatedBuildInputs = [ gdb ]; # needs GDB to replay programs at runtime
46 "-DCMAKE_C_FLAGS_RELEASE:STRING="
47 "-DCMAKE_CXX_FLAGS_RELEASE:STRING="
51 # we turn on additional warnings due to hardening
52 NIX_CFLAGS_COMPILE = "-Wno-error";
54 hardeningDisable = [ "fortify" ];
59 preCheck = "export HOME=$TMPDIR";
62 homepage = "https://rr-project.org/";
63 description = "Records nondeterministic executions and debugs them deterministically";
65 rr aspires to be your primary debugging tool, replacing -- well,
66 enhancing -- gdb. You record a failure once, then debug the
67 recording, deterministically, as many times as you want. Every
68 time the same execution is replayed.
71 license = with lib.licenses; [ mit bsd2 ];
72 maintainers = with lib.maintainers; [ pierron thoughtpolice ];
73 platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];