Have you ever tried to compile a helloworld Rust program in --release mode? If yes, have you seen its binary size? Suffice to say, it’s not exactly small. Or at least it wasn’t small until recently. This post details how I found about the issue and my attempt to fix it in Cargo.
It’s also what I understood from what I read but I assume it was just a poor choice of word. Debug symbols are way too important for debugging to be stripped by default.
In fact, this new default will be used for any profile which does not enable debuginfo anywhere in its dependency chain, not just for the release profile.
On reflection I imagine the debug profile does enable this
As mentioned in the article, this concerns release mode, which already does not have symbols by default for user code. It does have symbols for the standard library code, however, due to how the binaries for the standard library are shipped (i.e. with symbols only). This change simply also removes standard library symbols.
If you need symbols, you can use default debugging build, or if you need both compiler optimizations and debugging symbols you can create a custom profile that inherets from release with debug = true. The second you already need to do to get full debugging symbols right now, so this isn’t really much of a change from a workflow standpoint.
In fact, this new default will be used for any profile which does not enable debuginfo anywhere in its dependency chain, not just for the release profile.
This is the sentence that tripped me up. But on rereading I’m assuming the debug profile does enable this.
So debug builds now strip it by default as well?
It’s also what I understood from what I read but I assume it was just a poor choice of word. Debug symbols are way too important for debugging to be stripped by default.
On reflection I imagine the debug profile does enable this
Yeah, this make sence
As mentioned in the article, this concerns release mode, which already does not have symbols by default for user code. It does have symbols for the standard library code, however, due to how the binaries for the standard library are shipped (i.e. with symbols only). This change simply also removes standard library symbols.
If you need symbols, you can use default debugging build, or if you need both compiler optimizations and debugging symbols you can create a custom profile that inherets from release with debug = true. The second you already need to do to get full debugging symbols right now, so this isn’t really much of a change from a workflow standpoint.
This is the sentence that tripped me up. But on rereading I’m assuming the debug profile does enable this.
Yeah, definitely :)
The default dev profile is defined as:
[profile.dev] opt-level = 0 debug = true split-debuginfo = '...' # Platform-specific. strip = "none" debug-assertions = true overflow-checks = true lto = false panic = 'unwind' incremental = true codegen-units = 256 rpath = false
You can find more information in the cargo book page on profiles
I knew I had to be missing something. Thanks for the insight mate.
I guess it may use external debug symbols and strip them from the binary by default.
Otherwise seems like a massive change haha