1 { lib, stdenv, fetchFromGitHub, fetchpatch
2 , cmake, pkg-config, which, makeWrapper
3 , libpfm, zlib, python3Packages, procps, gdb, capnproto
6 stdenv.mkDerivation rec {
10 src = fetchFromGitHub {
14 hash = "sha256-n1Jbhr77bI0AXncY/RquNVSwwnnAXt31RmKtAa1/oHg=";
20 substituteInPlace src/Command.cc --replace '_BSD_SOURCE' '_DEFAULT_SOURCE'
21 sed '7i#include <math.h>' -i src/Scheduler.cc
22 sed '1i#include <ctime>' -i src/test-monitor/test-monitor.cc
26 # With LTO enabled, linking fails with the following message:
28 # src/AddressSpace.cc:1666: undefined reference to `rr_syscall_addr'
29 # ld.bfd: bin/rr: hidden symbol `rr_syscall_addr' isn't defined
30 # ld.bfd: final link failed: bad value
31 # collect2: error: ld returned 1 exit status
33 # See also https://github.com/NixOS/nixpkgs/pull/110846
34 preConfigure = ''substituteInPlace CMakeLists.txt --replace "-flto" ""'';
36 nativeBuildInputs = [ cmake pkg-config which makeWrapper ];
38 libpfm zlib python3Packages.python python3Packages.pexpect procps gdb capnproto
44 # we turn on additional warnings due to hardening
45 env.NIX_CFLAGS_COMPILE = "-Wno-error";
47 hardeningDisable = [ "fortify" ];
52 preCheck = "export HOME=$TMPDIR";
54 # needs GDB to replay programs at runtime
56 wrapProgram "$out/bin/rr" \
57 --prefix PATH ":" "${lib.makeBinPath [
63 homepage = "https://rr-project.org/";
64 description = "Records nondeterministic executions and debugs them deterministically";
66 rr aspires to be your primary debugging tool, replacing -- well,
67 enhancing -- gdb. You record a failure once, then debug the
68 recording, deterministically, as many times as you want. Every
69 time the same execution is replayed.
72 license = with lib.licenses; [ mit bsd2 ];
73 maintainers = with lib.maintainers; [ pierron thoughtpolice ];
74 platforms = [ "i686-linux" "x86_64-linux" "aarch64-linux" ];