Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please strip release binary #738

Closed
szepeviktor opened this issue Jun 8, 2023 · 5 comments
Closed

Please strip release binary #738

szepeviktor opened this issue Jun 8, 2023 · 5 comments

Comments

@szepeviktor
Copy link
Contributor

szepeviktor commented Jun 8, 2023

$ file typos
typos: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, 
BuildID[sha1]=8f7bf8a54b62d8ebc982815e30076433d398c44d, not stripped

The typos binary gets smaller when stripping: strip typos

dosisod added a commit to dosisod/typos that referenced this issue Aug 5, 2023
See https://github.com/johnthagen/min-sized-rust

Here are some stats on the different flags I used and how much each step
reduced the binary size:

|           Method            |        Size        | Diff (%) |
|-----------------------------|--------------------|---------:|
| Master                      | 27633280 (27.6MB)  |      N/A |
| `strip`                     | 19544600 (19.5MB)  |   -29.3% |
| `strip` + `lto`             | 19028504 (19.0MB)  |   -31.1% |
| `strip` + `lto` + `codegen` | 18971160 (19.97MB) |   -31.3% |

Closes crate-ci#738.
@epage
Copy link
Collaborator

epage commented Aug 7, 2023

#791 attempted to do what this issue directly asked.

I have not looked into stripping before but my concerns are

  1. Quality of panic messages is not diminished
  2. Users wanting to debug the binary can

Unless there is a reason we shouldn't do (2), that means we need to not just strip but we also need to make sure our release process includes the separate debug symbols in the payload. At that point, I'm not as sure as to the benefit of doing this.

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Aug 7, 2023

I am from an old world 👴🏻
production was production, development was development.
For example Debian releases stripped binaries for production and debug symbols for debugging.

Note

Currently my update-typos.sh strips the binary

@szepeviktor
Copy link
Contributor Author

szepeviktor commented Aug 7, 2023

If you have unqualified users please close this issue.
I see many-many people thinking that development environment equals production environment. "You just have to copy things."
I know I live in a golden cage 🐦

@dpc
Copy link
Contributor

dpc commented Oct 11, 2023

[profile.release]
debug = "line-tables-only"

and

[target.x86_64-unknown-linux-gnu]
rustflags = ["-C", "link-arg=-Wl,--compress-debug-sections=zlib"]

is a combo that became available in some recent Rust release I've been using nowadays that makes the binary smaller, yet preserves the (most essential?) symbols which makes stacktraces in errors and panics informative.

make sure our release process includes the separate debug symbols in the payload.

I'd be interested in how to get it done.

@szepeviktor
Copy link
Contributor Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants