版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/BaiHuaXiu123/article/details/88587089
交叉编译(Cross Compiler)
Target | std | rustc | cargo | notes |
---|---|---|---|---|
i686-apple-darwin | ✓ | ✓ | ||
i686-pc-windows-gnu | ✓ | ✓ | ||
i686-pc-windows-msvc | ✓ | ✓ | ||
i686-unknown-linux-gnu | ✓ | ✓ | ||
x86_64-apple-darwin | ✓ | ✓ | ||
x86_64-pc-windows-gnu | ✓ | ✓ | ||
x86_64-pc-windows-msvc | ✓ | ✓ | ||
x86_64-unknown-linux-gnu | ✓ | ✓ |
添加目标平台-工具链(toolchain) = 标准库
例:添加 32-bit Linux (2.6.18+)
$ rustup target add i686-unknown-linux-gnu
添加目标平台-编译器(compiler)
添加目标平台-链接器(linker )
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc-4.7"
查看目标平台
$ rustup target list
交叉编译工具链
linux
编译到目标平台
$ cargo build --target=i686-unknown-linux-gnu