Why binaries and shared libraries in Rust toolchains are not stripped?

Hello. I'm wondering why binaries like cargo, cargo-clippy, rustc, etc. and shared libraries like librustc_driver-*.so and libLLVM-14-rust-*.so are shipped with debugging symbols. I want to minimize size of my Docker image. Is it safe to just run strip on all of binaries & shared libraries? Or will it break something, like backtraces in my crate? If it's safe, then why ship them unstripped in the first place?

Afaik it's not shipped like that because sometimes you want the backtraces (like if there's an internal compiler error). You should be able to safely strip all the binaries, as I don't think anything requires the debug symbols.


This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.