I'd like to use rust for a program being written on a raspberry pi that uses an ssd1306 oled display and found the ssd1306 crate and an example that runs on the raspberry pi and after some fiddling around it works but not perfectly and the crates used are older versions. I then found a newer example at https://github.com/PatrickLang/ssd1306/tree/raspi-example/examples/raspi that uses the latest crates and seems to generally be "better" but I can't get the example to build actually on a raspberry pi which is my preferred place to build as although I have the relevant toolschains installed I keep getting a>
pi@raspberrypi:~/ssd1306/examples/raspi $ cargo run
Compiling void v1.0.2
error[E0463]: can't find crate for std
|
= note: the thumbv7m-none-eabi target may not be installed
error: aborting due to previous error
For more information about this error, try rustc --explain E0463.
error: could not compile void.
i'm very much a rust newbie although i know the basics and this is driving me nuts
can anyone help or give me pointers on how to fix this so the example will build/run and then I can get back to work trying to port my program to rust which i'm doing to try to learn rust "properly"
thumbv7m-none-eabi is for bare metal targets. It only has libcore and I think liballoc. It doesn't have libstd. The correct triple is armv7-unknown-linux-gnueabi for the soft-float and armv7-unknown-linux-gnueabihf for the hard-float abi. (I am not quite sure which one is used by raspbian)
I actually started with the defaults that rustup installed and got the same error, exactly the same which is why I then installed the thumbv7m-none-eabi as that's what the error message said it needed.
pi@raspberrypi:~/ssd1306/examples/raspi $ rustup show
Default host: arm-unknown-linux-gnueabihf
rustup home: /home/pi/.rustup
thank you both. that WAS the solution and I feel a right wazzock now as i'd been struggling on this for 3 days as I just assumed that the target would be correct as it was the only toolchain originally installed and cargo/rustc would know that.
Ideally a cargo build should just work out of the box regardless of the platform, you shouldn't have needed to mess about with targets. The fact that it happened again after reinstalling may indicate a bug instead of user error.
If you haven't done so already, you can set the default target with rustup default stable-arm-unknown-linux-gnueabihf.