主要流程:
下载Linux版本Rust x86_64-unknown-linux-gnu
- 运行脚本安装,输入1,回车。1) Proceed with installation (default)
- 查看目标 $
rustc --print target-list
- $
rustup target add armv7-unknown-linux-gnueabihf
$
cat ~/.cargo/config
结果如下[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"
交叉编译Debug版本
cargo build --target=armv7-unknown-linux-gnueabihf
- 交叉编译Release版本
cargo build --target=armv7-unknown-linux-gnueabihf --release
其他命令:
更新Rust:rustup update
卸载Rust:rustup self uninstall
更改为清华源
[source.crates-io]
replace-with = 'tuna'
[source.tuna]
registry = "https://mirrors.tuna.tsinghua.edu.cn/git/crates.io-index.git"
解决:Blocking waiting for file lock on package cache
rm ~/.cargo/.package-cache
上一篇:交叉编译OpenSSL