-
It's faster to build your code on your laptop than the Pi
-
It's not always possible to build on a Pi:
# On the Pi Zero
Compiling tract-core v0.3.4-pre (/home/pi/workspace/tract/core)
memory allocation of 37748736 bytes failed
error: Could not compile `tract-core`.
-
Install Docker
-
Add Rust targets
rustup target add armv7-unknown-linux-gnueabihf # Pi
rustup target add arm-unknown-linux-gnueabihf # Pi 0
rustup target list
- Clone cross and build it
git clone git@github.com:rust-embedded/cross.git
cd cross
cargo build --release
# You may get some warning about `$HOME`, just disregard that.
cd target/release
-
Docker has to be running or you will get errors!
-
Go to the code directory you want to build
cd ~/workspace/tract/examples
- Build the code with cross
/Users/DanielBank/workspace/cross/target/release/cross build --release --target=armv7-unknown-linux-gnueabihf --manifest-path=examples/tensorflow-mobilenet-v2/Cargo.toml
# The following don't work:
# Well, this worked the first time I built my code but it gave me a cryptic error on subsequent attempts
/Users/DanielBank/workspace/cross/target/release/cross build --release --target=armv7-unknown-linux-gnueabihf
# This just builds the code for your laptop's architecture because you didn't specify a target
/Users/DanielBank/workspace/cross/target/release/cross build --release
- More about that cryptic error
error: failed to load source for a dependency on \`tract-core\`
Jacob Rosenthal [28 days ago]
I think Ive seen this before with cross and local crates... but i know we built this last time so...not sure what were missing
Jacob Rosenthal [28 days ago]
and those cargo.toml dont seem to have changed so presumably you didnt pull an upstream change...
Jacob Rosenthal [28 days ago]
So I think the cross docker is mapping from the directory we call from, so cant see up a directory (..) no idea how we got it to work last time then??.. we could run the example from the main directory, but --example doesnt work because they use a virtual workspace
- Issues with Pi Zero Architecture
/Users/DanielBank/workspace/cross/target/release/cross build --release --target=arm-unknown-linux-gnueabihf --manifest-path=examples/tensorflow-mobilenet-v2/Cargo.toml
Unable to find image 'japaric/arm-unknown-linux-gnueabihf:latest' locally
The repo you want to clone: https://github.com/rust-embedded/cross
Don't be fooled by this one: https://github.com/japaric/rust-cross
https://github.com/snipsco/tract
https://github.com/snipsco/tract/tree/master/examples/tensorflow-mobilenet-v2
# Just so I am not flailing around trying to remember commands
cd /Users/DanielBank/workspace/tract/target/armv7-unknown-linux-gnueabihf
scp ./tract-mobilenet-v2-example pi@<IP>:compiled-tract/tract-mobilenet-v2-example
sam devices
sam connect <IP>
sam test speaker
sam setup audio
sam install assistant
rustup default nightly rustup default stable
- Specs on a RPI... memory... disk space... nah you can just get a better sd card
cargo install --force --git https://github.com/rust-embedded/cross cross