Hi Rusteceans. I am can anyone explain to me why after compiling a small program like hello world or "sum of two numbers", the source file is less than 1kb but the resulting binary after compilation with rustc is not less than 4MB on Linux Debian
There are several post on this topic
There's article in the May 2016 Linux Format magazine on using Rust.
In it, the author used the [Li|U]nix command strip to reduce the 'Hello World' executable size.
Here's and example with a Rust executable of a program I created.
jzakiya@localhost ~ $ file prodfactors
prodfactors: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=5ec13d16cc5767604036150ee9e967f87d3b7cb7, not stripped
jzakiya@localhost ~ $ …
Continuation of the discussion from
My question was wether there would be any genuine issues / behabiour changes caused by stripping all release binaries by default?
IIRC, you might get worse stack traces?
Debuginfo isn't on by default for release targets. C compilers don't strip by default either.
With the important caveat that debug infor for stdlib is always there (because the same release+debuginfo build of stdlib is used for both debug …
And there is this article about it also
Rustlog : Why is a Rust executable large?