Correcting falsehoods in tech documentation, lessons learned

Rust on OpenWrt – baby steps

Well, it works, at least hello world. I followed the steps here: http://www.cnblogs.com/yido9932/p/3980362.html but had to make a few changes. First, I’m using the old atheros target, so I used “mips-unknown-linux-gnu” instead of mipsel. I still had to make symlinks into the STAGING_DIR path, because rust required the compiler to be with a certain name, and the target triplets don’t line up with OpenWrt.

I also had to remove the -mno-compact-eh flags from [rustroot]/mk/platform.mk in a couple of places. This is an unknown option in gcc as far as I can tell, it appears to be only in CodeSourcery/Mentor’s hacked up version? Then to actually compile the code I needed a few more incantations…

And, there’s been a rust language change since that blogpost was made. Using the sample code from that article, you’ll get an error on the “hicore.rs” example about error: language item required, but not found: `fail_fmt`, so you need to add an extra magic line into your sample code,

All in all, somewhat neat, maybe, I guess. But the rust std library is huge, as noted in the google translation of the chinese article linked above. And writing it all in “unsafe” code sounds kinda pointless. So, maybe not so interesting for OpenWrt at this point, but it runs at least.