this post was submitted on 24 Jan 2024
90 points (97.9% liked)

Rust

5346 readers
1 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

[email protected]

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS
 

Upto 90% for hellworld

top 13 comments
sorted by: hot top controversial new old
[–] [email protected] 6 points 9 months ago (1 children)

So debug builds now strip it by default as well?

[–] [email protected] 9 points 9 months ago (3 children)

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.

[–] [email protected] 5 points 9 months ago (1 children)

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

[–] [email protected] 4 points 9 months ago

Yeah, this make sence

[–] [email protected] 3 points 9 months ago* (last edited 9 months ago) (1 children)

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.

[–] [email protected] 2 points 9 months ago* (last edited 9 months ago) (1 children)

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.

[–] [email protected] 3 points 9 months ago (1 children)

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

[–] [email protected] 1 points 9 months ago

I knew I had to be missing something. Thanks for the insight mate.

[–] [email protected] 2 points 9 months ago

I guess it may use external debug symbols and strip them from the binary by default.

Otherwise seems like a massive change haha

[–] [email protected] 5 points 9 months ago

So this is around 4MB less, right? The small app I'm currently working on is 15MB so with this change it will be 11MB. Nice but nothing revolutionary. It will have bigger impact on a really tiny apps. I guess that's why it wasn't resolved for so long.

[–] [email protected] 4 points 9 months ago (1 children)

Quite an interesting writeup, going to go check out Rust now (I tell myself for the umpteenth time).

[–] [email protected] 5 points 9 months ago (1 children)

Join us, the water is great. :)

[–] [email protected] 5 points 9 months ago

Is that because of the iron supplement?