rules_rust
rules_rust copied to clipboard
feat: Strip debug info from opt builds
Attempts to follow the cargo proposal linked below to remove debug info for release builds. Furthermore this should uphold the expected behavior of bazel for cc builds which automatically strips debug symbols for optimized builds.
https://github.com/rust-lang/cargo/issues/4122#issuecomment-1868318860
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Looks like this change needs a rebase.
@UebelAndre can you point me in the right direction for the CI error I'm getting?
Looks like a CI infra issue. @meteorcloudy @scentini
I see this on other PRs
Sorry about the breakage, we fixed the CI and I re-triggered your presubmit.
@UebelAndre what did you have in mind for checking that it transitions correctly?
I could do something a little hacky where I compile for copt and then use output of that in a test where I check for debug symbols using file or something? But seems like there is probably a cleaner way to do this test
@UebelAndre what did you have in mind for checking that it transitions correctly?
I could do something a little hacky where I compile for copt and then use output of that in a test where I check for debug symbols using file or something? But seems like there is probably a cleaner way to do this test
https://github.com/bazelbuild/rules_rust/pull/2578 is what I was thinking (though this is for opt_level). Something like this but that covers strip_level.
@UebelAndre I added a new strip_level test tho it might be cleaner to just include that in the opt_level test. Could go either way here.
It looks like the windows builds are broken. I don't have a windows machine and have little insight here on how it wants to handle the debug symbols which seem to be in a separate file. @UebelAndre @scentini any thoughts here? I could just disable this feature for windows builds but that seems sad.
Feel free to ping me when this is ready for review!
@UebelAndre I think this could use a look now. I had to do some special handling for the pdb tests and I just patterned matched what we did for the strip_level tests.