at master 2.5 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 bash, 6 capnproto, 7 cmake, 8 gdb, 9 libpfm, 10 makeWrapper, 11 nix-update-script, 12 pkg-config, 13 procps, 14 python3, 15 which, 16 zlib, 17 zstd, 18}: 19 20stdenv.mkDerivation (finalAttrs: { 21 version = "5.9.0"; 22 pname = "rr"; 23 24 src = fetchFromGitHub { 25 owner = "rr-debugger"; 26 repo = "rr"; 27 rev = finalAttrs.version; 28 hash = "sha256-o+HXrgGXdsvjlNh70qsXRtp2yXOiZIT30ejfs1KEaqE="; 29 }; 30 31 postPatch = '' 32 substituteInPlace src/Command.cc --replace '_BSD_SOURCE' '_DEFAULT_SOURCE' 33 patchShebangs src 34 ''; 35 36 # With LTO enabled, linking fails with the following message: 37 # 38 # src/AddressSpace.cc:1666: undefined reference to `rr_syscall_addr' 39 # ld.bfd: bin/rr: hidden symbol `rr_syscall_addr' isn't defined 40 # ld.bfd: final link failed: bad value 41 # collect2: error: ld returned 1 exit status 42 # 43 # See also https://github.com/NixOS/nixpkgs/pull/110846 44 preConfigure = '' 45 substituteInPlace CMakeLists.txt --replace "-flto" "" 46 ''; 47 48 strictDeps = true; 49 50 nativeBuildInputs = [ 51 capnproto 52 cmake 53 makeWrapper 54 pkg-config 55 python3.pythonOnBuildForHost 56 which 57 ]; 58 59 buildInputs = [ 60 bash 61 capnproto 62 gdb 63 libpfm 64 procps 65 python3 66 zlib 67 zstd 68 ]; 69 70 cmakeFlags = [ 71 (lib.cmakeBool "disable32bit" true) 72 (lib.cmakeBool "BUILD_TESTS" finalAttrs.finalPackage.doCheck) 73 ]; 74 75 # we turn on additional warnings due to hardening 76 env.NIX_CFLAGS_COMPILE = "-Wno-error"; 77 78 hardeningDisable = [ "fortify" ]; 79 80 # FIXME 81 doCheck = false; 82 83 preCheck = "export HOME=$TMPDIR"; 84 85 # needs GDB to replay programs at runtime 86 preFixup = '' 87 wrapProgram "$out/bin/rr" \ 88 --prefix PATH ":" "${lib.makeBinPath [ gdb ]}"; 89 ''; 90 91 passthru.updateScript = nix-update-script { }; 92 93 meta = { 94 homepage = "https://rr-project.org/"; 95 description = "Records nondeterministic executions and debugs them deterministically"; 96 longDescription = '' 97 rr aspires to be your primary debugging tool, replacing -- well, 98 enhancing -- gdb. You record a failure once, then debug the 99 recording, deterministically, as many times as you want. Every 100 time the same execution is replayed. 101 ''; 102 103 license = with lib.licenses; [ 104 mit 105 bsd2 106 ]; 107 maintainers = with lib.maintainers; [ 108 pierron 109 thoughtpolice 110 lf- 111 ]; 112 platforms = [ 113 "aarch64-linux" 114 "i686-linux" 115 "x86_64-linux" 116 ]; 117 }; 118})