Earlier quoted context omitted.
Considering the repo dates back to 2010 (predating Rust by 4+ years), there probably wasn’t a better option that could run on the embedded devices that OpenWRT targets.
The project age is good background info. However Rust didn't invent memory-safety, there were reasonable options for system programming at that time too (eg Ocaml, Go, Ada, etc). edit: Also D in safe mode like mentioend above - not sure if it was around in 2010?
Ubus (OpenWrt micro bus architecture)
21–30 of 56 posts
Re: Ubus (OpenWrt micro bus architecture)
#22Earlier quoted context omitted.
200k is very large in the OpenWrt world
Ada then? Eg on https://ada.godbolt.org/ you can see the default program compiled to ~25 lines of assembler. edit: actually it contains a call to a bounds check function that presumably is in the runtime library, i don't know how big that is. A major point in this is that C also has a fairly big runtime library that should be factored into the comparison!
The original releases of OpenWRT used uClibc, which is nowhere near Glibc levels of bloat (Musl beats it on code quality and is used today, but didn’t exist back then). Also, yeah, you’re going to have a libc on a Linux system no matter what, so this is one of the rare cases where dynamic linking makes for a legitimate optimization.
Re: Ubus (OpenWrt micro bus architecture)
#23Earlier quoted context omitted.
200k is very large in the OpenWrt world
Ada then? Eg on https://ada.godbolt.org/ you can see the default program compiled to ~25 lines of assembler. edit: actually it contains a call to a bounds check function that presumably is in the runtime library, i don't know how big that is. A major point in this is that C also has a fairly big runtime library that should be factored into the comparison!
You can still build software for OpenWRT that requires the much bigger Glibc, but of course it will not work that well on devices with limited memory.
Re: Ubus (OpenWrt micro bus architecture)
#24[1] https://web.archive.org/web/20131209010702/http://unixbus.or...
Re: Ubus (OpenWrt micro bus architecture)
#25Re: Ubus (OpenWrt micro bus architecture)
#26Did they consider using a memory-safe language for this?
Binary size is sometimes a big deal. Two decades ago I investigated using C++ for an "embedded" linux ssh server, but decided the 30kB overhead was too large (target was a 4MB laptop). The server ended up being used in OpenWRT and other places, I'm curious if it would have happened if I'd gone with C++ instead.
Re: Ubus (OpenWrt micro bus architecture)
#27Story time.. I coded a similar thing when I started working after graduation for a DTV software company; we needed to have an IPC on Linux and I whipped up some very crude equivalent of protobuf (which I didn’t know about), based on an RLE lib i stumbled upon and without any form of discovery. It was circa 2009, I had only been exposed to plain text protocols and didn’t know about json. In hindsight, we might’ve been…
Also I think "any problem is solvable" needs some qualification - there are a ton of problems that have yet to be solved or are super complicated. I still haven't figured out how unbounded model checking works for example.
Re: Ubus (OpenWrt micro bus architecture)
#28Earlier quoted context omitted.
Ada then? Eg on https://ada.godbolt.org/ you can see the default program compiled to ~25 lines of assembler. edit: actually it contains a call to a bounds check function that presumably is in the runtime library, i don't know how big that is. A major point in this is that C also has a fairly big runtime library that should be factored into the comparison!
Current OpenWRT uses musl libc[1] which can be optimized to have a tiny footprint and supports full static linking, before that it used ucLibc which was similarly optimized. You can still build software for OpenWRT that requires the much bigger Glibc, but of course it will not work that well on devices with limited memory. [1]: https://musl.libc.org/
Re: Ubus (OpenWrt micro bus architecture)
#29Did they consider using a memory-safe language for this?
A decent question, I've wondered about Rust programs on openwrt but at the moment they're just too big! Linking the stdlib into every binary doesn't help, and the code is generally larger than the C equivalent. It doesn't seem unsolvable though, I'm hopeful. no_std rust binaries can be near competitive with C. Binary size is sometimes a big deal. Two decades ago I investigated using C++ for an "embedded" linux ssh se…
I feel like Rust without std might as well be a different language. Almost all of the available mindshare, docs, libraries are dependant on it.
Sure, you can use it. But to me it just looks like technological poverty. Even compared to the C ecosystem.
Re: Ubus (OpenWrt micro bus architecture)
#30Earlier quoted context omitted.
A decent question, I've wondered about Rust programs on openwrt but at the moment they're just too big! Linking the stdlib into every binary doesn't help, and the code is generally larger than the C equivalent. It doesn't seem unsolvable though, I'm hopeful. no_std rust binaries can be near competitive with C. Binary size is sometimes a big deal. Two decades ago I investigated using C++ for an "embedded" linux ssh se…
>I'm hopeful. no_std rust binaries can be near competitive with C. I feel like Rust without std might as well be a different language. Almost all of the available mindshare, docs, libraries are dependant on it. Sure, you can use it. But to me it just looks like technological poverty. Even compared to the C ecosystem.
There were sufficient crates to write a ssh server for a rp2040 (mostly out of curiosity) using what's available in no_std.