rustybox, an experimental fork written entirely in Rust

Eli Schwartz eschwartz at archlinux.org
Fri Nov 15 00:29:14 UTC 2019


On 11/14/19 5:33 PM, Markus Gothe wrote:
> How do you think that fatso library aptly named librust would fit into any 
> modest embedded system? Well it doesn't and you never thought of that in the 
> first place which makes the rest of your assumptions more damaging than any good.

I was under the impression that rust programs don't depend on librust at
all, due to being statically compiled. My instinctive reaction to
porting anything to rust would instead first center around "is rust
itself portable?"

To which the answer is a resounding no. C compilers are everywhere, and
busybox should be able to compile and run on any unix-like platform, one
hopes, whereas rust is only available on platforms that the reference
implementation of rust (the only implementation of rust) is available.
Rust is also written in rust so you cannot bootstrap it to new
platforms. Rust only has first-class support for Windows, Linux, and macOS.

That being said, the size of a statically compiled rust program is also
of concern. A minimally viable hello_world.rs compiled with static musl
libc, and stripped, is 248K -- a minimally viable hello_world.c compiled
with musl-gcc -static is 16KB.

(At least it is not as bad as golang, where "hello world" is 1.4 MB,
larger than the entire busybox suite with all the fatty options enabled
for my desktop build.)

Also google-fu says you can "cheat" by embedding non-rust inside your
rust, to reduce some overhead of using rust:
https://lifthrasiir.github.io/rustlog/why-is-a-rust-executable-large.html

But on the whole it seems simpler to stick with what is known to work
and has no known downsides.

-- 
Eli Schwartz
Arch Linux Bug Wrangler and Trusted User

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1601 bytes
Desc: OpenPGP digital signature
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20191114/54e07bb6/attachment.asc>


More information about the busybox mailing list