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

binary size is scary #140

Closed
Fiedzia opened this issue Mar 21, 2014 · 7 comments
Closed

binary size is scary #140

Fiedzia opened this issue Mar 21, 2014 · 7 comments

Comments

@Fiedzia
Copy link
Contributor

Fiedzia commented Mar 21, 2014

I know its a rust issue, but looking at about 3MB for each binary, versus around 100KB for coreutils binaries on my system (ubuntu 14.04), I wonder if there is anything that can be done to cut it down.

@Arcterus
Copy link
Collaborator

I don't think there's a whole lot we can do. I mean, we could strip unneeded symbols after compilation, but that doesn't really solve the problem (the binaries would still be huge). IMO, the best we can hope for is the Rust compiler eventually generating smaller binaries.

@huonw
Copy link
Contributor

huonw commented Mar 21, 2014

This is 100% a compiler & standard library issue; the smallest one can get a statically linked executable that uses std is basically 700KB, even with optimisations on, LTO and stripping.

Work-arounds include:

  • dynamic linking (compile with -C prefer-dynamic),
  • a busybox-style unified binary that includes all the tools internally, and dispatches based on the name with which it was called, to amortize the overhead across everything,
  • not using the standard library.

@hexsel
Copy link

hexsel commented Aug 28, 2015

On the current version of the project, most binaries end up between 271kB - 471kB (stripping on, LTO off due to this bug).

Is there a need to make this any smaller?

rustc 1.4.0-nightly (63ba780fd 2015-08-23)
OSX 10.10.4

@nightmared
Copy link

What about shipping a standard library for OS not having rust library and using dynamic linking ?

@nathanross
Copy link
Contributor

see the issue above for more details on this issue, dynamic linking.

@abique
Copy link

abique commented Mar 22, 2016

I like the busybox idea.

@knight42
Copy link
Contributor

duplicated #747

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

No branches or pull requests

8 participants