How can I compile Rust code to run on a Raspberry Pi 2?

前端 未结 3 1243
旧时难觅i
旧时难觅i 2021-01-30 17:54

I recently acquired a Raspberry PI 2 and I want to run a Rust program on it.

Is there a guide/instructions how to cross compile Rust programs on Raspberry PI 2? I\'ve h

3条回答
  •  耶瑟儿~
    2021-01-30 18:14

    We have rustup now.

    $ rustup target add arm-unknown-linux-gnueabihf
    $ sudo apt-get install gcc-arm-linux-gnueabihf
    $ echo '[target.arm-unknown-linux-gnueabihf]' >> ~/.cargo/config
    $ echo 'linker = "arm-linux-gnueabihf-gcc"' >> ~/.cargo/config
    $ cd 
    $ cargo build --target=arm-unknown-linux-gnueabihf
    

提交回复
热议问题