Remix.run Logo
synergy20 7 months ago

For me, Rust has a size issue, its std lib after strip is at least 3x as to libstdc++, and Rust is default to statically link to that lib! When you have a few Rust binaries, the storage space adds up quickly, not a good fit for embedded boards where storage is limited(same problems for Go, by the way).

Why can't Rust have a mode to do what c/c++/etc doing, that is, a reasonably sized standard library to link to? Yes I'm aware of 'how to minimize rust size' and 'prefer-dynamic', still comparing to c/c++, it is so much worse when storage size is a concern.

robertlagrant 7 months ago | parent | next [-]

Maybe it can. Why don't you propose[0] a list of features that would fit your requirements? You never know!

[0] https://lang-team.rust-lang.org/how_to/nominate.html

synergy20 7 months ago | parent [-]

I'm not very hopeful as it has been discussed in the past. If Rust will ever replace C++, binary size is one of its biggest weakness in my opinion.

Been safer is far from enough to replace the incumbent, you also need win in simplicity, speed, size, ecosystem,etc. Size at the moment is the most obvious problem as far as I can tell.

yolovoe 7 months ago | parent | prev | next [-]

An increasing amount of AWS EC2 dataplane (Nitro firmware/software) is using Rust.

We hit this issue too, and our solution was to go busybox-style with binaries. One binary that then gets linked to with different names. Solved the problem for us.

synergy20 7 months ago | parent [-]

firmware probably needs no stdlib at all,just the language itself,so rust for low level is fine

when stdlib is needed then size becomes a big issue, yes busybox approach helps,but.

johnnyanmac 7 months ago | parent | prev | next [-]

It's probably less a concern because storage size at that level (MB's) is only really relevant in Embedded. So it was lower priority for stakeholders compared to the other advantages

zozbot234 7 months ago | parent | prev [-]

Did you try https://github.com/johnthagen/min-sized-rust ?

synergy20 7 months ago | parent [-]

yes as mentioned,it's still too large compared to c++ when i have multiple executables