3 ms·
Have you seen that rustup makes using musl with rustc really easy [0]? One can then additionally forgo things like the optimised jemalloc allocator and the main
by dbaupp 10y ago
Have you seen that rustup makes using musl with rustc really easy [0]? One can then additionally forgo things like the optimised jemalloc allocator and the main standard library (just using libcore) to knock the binary size down to what C gives. [0] discusses this in much more detail (especially towards the end).
[0]: https://blog.rust-lang.org/2016/05/13/rustup.html#example-building-static-binaries-on-linux https://blog.rust-lang.org/2016/05/13/rustup.html#example-bu...
[1]: https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html https://lifthrasiir.github.io/rustlog/why-is-a-rust-executab...
- shakna 10y ago> Today rustup provides access to the standard library, but as we’ve seen in this post, there’s more to cross-compilation than rustc + std. It’s acquiring and configuring the linker and C toolchain that is the most vexing Unfortunately I'd have to agree with this, C is just easier. > We have knocked debug symbols down, now let’s get rid of the remaining libraries. Some bad news: From this point on you are entering the realm of nightly Rust. This realm is not as scary as you might think, as it doesn't break in your face, but it may break in smaller ways (which is why we have nightlies!). That’s the major reason that we don’t yet have nightly features in stable– they may change. Relying on a nightly for production code is simply not something I would ever get approved. I sort of hope that as Rust solves these issues, tools like rustup and Cargo will get to the state of Red and its cross-compilation state. (Compile for Linux-86, Linux-ARM, Windows, macOS, Android with one flag from the one compiler. Which is less than 1mb, statically linked.)