RazrFalcon / cargo-bloat

Find out what takes most of the space in your executable.
MIT License
2.37k stars 50 forks source link

How do I use cargo bloat with `-Zbuild-std`? #81

Closed vi closed 2 years ago

vi commented 2 years ago

It does not accept -Z option. And if I omit it, it start rebuilding the crate again instead of just analysing already built crate.

RazrFalcon commented 2 years ago

-Z build-std ?

vi commented 2 years ago

Yes.

Activating e.g. -Zbuild-std-features=panic_immediate_abort can drastically reduce bloat when aiming at sub-50kb executables, and analysing what still remains after removing libstd's string formatting and other debugging features can be benefitial.

RazrFalcon commented 2 years ago

Yes, I know what this option do. I'm saying you need a space after -Z.

vi commented 2 years ago

It does not work either way:

Error: unused arguments left: -Z, build-std=panic_abort,std, -Z, build-std-features=panic_immediate_abort.

Error: unused arguments left: -Zbuild-std=panic_abort,std, -Zbuild-std-features=panic_immediate_abort.

It Cargo, it works both with and without the space between -Z and subargument.

RazrFalcon commented 2 years ago

Are you sure you're using the latest cargo bloat?

Something like cargo +nightly bloat --release -Z build-std --target aarch64-apple-darwin --crates works just fine for me.

vi commented 2 years ago

Indeed, I was using 0.10 and after upgrading to 0.11 -Z build-std started working.

-Zbuild-std also works, but produces different result (as if the option were not specified at all).

Maybe Warning: unused arguments left: ["-Zbuild-std=pa should be error by default, unless some --force is specified?

RazrFalcon commented 2 years ago

I will think about it.