crate2nix icon indicating copy to clipboard operation
crate2nix copied to clipboard

Is it possible to use separateDebugInfo with crate2nix?

Open bbigras opened this issue 5 years ago • 2 comments

I can't figure out how to use separateDebugInfo.

I guess I would need something like:

{
  extraRustcOpts = ["-g"];
  separateDebugInfo = true;
}

and I think I would like that enabled for all my dependencies so I tried to add it to Cargo.nix:

          in
          buildRustCrateForPkgsFunc pkgs
            (
              crateConfig // {
                src = crateConfig.src or (
                  pkgs.fetchurl rec {
                    name = "${crateConfig.crateName}-${crateConfig.version}.tar.gz";
                    # https://www.pietroalbini.org/blog/downloading-crates-io/
                    # Not rate-limited, CDN URL.
                    url = "https://static.crates.io/crates/${crateConfig.crateName}/${crateConfig.crateName}-${crateConfig.version}.crate";
                    sha256 =
                      assert (lib.assertMsg (crateConfig ? sha256) "Missing sha256 for ${name}");
                      crateConfig.sha256;
                  }
                );
                extraRustcOpts = ["-g"];
                separateDebugInfo = true;
                inherit features dependencies buildDependencies crateRenames release;
              }
            );

but I get:

error: builder for '/nix/store/7vfp7gpmyp6gwsjblccbjvglmhzl3x7b-rust_ahash-0.4.7.drv' failed to produce output path for output 'debug' at '/nix/store/7vfp7gpmyp6gwsjblccbjvglmhzl3x7b-rust_ahash-0.4.7.drv.chroot/nix/store/h1phr8m7pqpx64nhfz9mg7r8zkcq8i9g-rust_ahash-0.4.7-debug'

I'm guessing some crates don't produce symbols or something.

My goal is to send all my symbols to sentry.

bbigras avatar Apr 22 '21 18:04 bbigras

  1. There is a release argument that you can set to false but I doubt it will generate separate debug info.
  2. This feature probably needs support of buildRustCrate in nixpkgs. https://github.com/NixOS/nixpkgs/tree/master/pkgs/build-support/rust/build-rust-crate

kolloch avatar Apr 24 '21 18:04 kolloch

I'm revisiting this.

This feature probably needs support of buildRustCrate in nixpkgs. https://github.com/NixOS/nixpkgs/tree/master/pkgs/build-support/rust/build-rust-crate

Adding separateDebugInfo = true; to Cargo.nix seems to work. I guess this mean that buildRustCrate already support it.

Could we get a new argument to be able to set it :pray:?

bbigras avatar Jul 07 '23 04:07 bbigras