Hi,
I stumbled on this thread while looking to see if Rust is already a good candidate for OpenWRT package development. Currently we develop everything in C but the added value of Rust's thread safety and compile time memory access validation would be huge. Especially because valgrind or any other runtime memory debuggers aren't created for the MIPS targets we use.
@Grommish thank you very much for your dedication and hard work. I have downloaded your latest version of the lang/rust
package (from 6 days ago) in my OpenWRT 19.07 toolchain. As I'm willing to compile a simple Hello World
rust program for my MIPS target. The build was failing the first time but I found out this was because I didn't have ccache
installed on my host. Now the build succeeds
I'm however not succeeding in getting a minimal Hello World example working. I've now created a simple package and a Makefile like this:
daanpape/rust-hello-world: Attempt to make a simple Rust Hello World example in OpenWRT (github.com)
And I'm getting a linker error:
error: linking with `cc` failed: exit code: 1
|
= note: /usr/bin/ld: main.main.7rcbfp3g-cgu.0.rcgu.o: relocations in generic ELF (EM: 8)
/usr/bin/ld: main.main.7rcbfp3g-cgu.0.rcgu.o: relocations in generic ELF (EM: 8)
/usr/bin/ld: main.main.7rcbfp3g-cgu.0.rcgu.o: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status
Could you give me any pointers?
Update: I got it working by looking at the suricata example. I updated the github. I'm going to try and add some floating point operations, also the binary is quite large. I think this might be optimized in the future.