ble*_*tin 3 cross-compiling rust
我在64位Windows计算机上使用rustc并cargo在其中编译32位应用程序。在使用稳定的工具链时,此方法可以很好地工作,但是当我尝试使用beta工具链时,它将失败。
Beta版工具链已成功安装rustup install beta。在项目文件夹中,有一个.cargo/config包含以下行的文件:
[build]
target = "i686-pc-windows-msvc"
[target.i686-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]
Run Code Online (Sandbox Code Playgroud)
运行cargo +beta build时发生以下错误:
[build]
target = "i686-pc-windows-msvc"
[target.i686-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]
Run Code Online (Sandbox Code Playgroud)
我试图运行rustup target add i686-pc-windows-msvc以解决此问题,但没有帮助;rustup target list甚至显示为“已安装”。可能此命令仅添加稳定目标,而我找不到如何指定beta工具链。
如何为Beta工具链添加另一个(非默认)目标?
阅读有关的帮助rustup target add:
$ rustup target add --help
rustup-target-add
Add a target to a Rust toolchain
USAGE:
rustup target add [OPTIONS] <target>...
FLAGS:
-h, --help Prints help information
OPTIONS:
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see
`rustup help toolchain`
Run Code Online (Sandbox Code Playgroud)
因此,您想要:
rustup target add i686-pc-windows-msvc --toolchain beta
Run Code Online (Sandbox Code Playgroud)
我相信它将默认将目标添加到“当前”工具链中,因此您也可以这样做:
rustup override set beta # in your project directory
rustup target add i686-pc-windows-msvc #
cargo build # no more +beta
Run Code Online (Sandbox Code Playgroud)
rustup target list甚至显示为“已安装”
阅读有关的帮助rustup target list:
$ rustup target list --help
rustup-target-list
List installed and available targets
USAGE:
rustup target list [OPTIONS]
FLAGS:
-h, --help Prints help information
OPTIONS:
--toolchain <toolchain> Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see
`rustup help toolchain`
Run Code Online (Sandbox Code Playgroud)
因此,您想要:
rustup target list --toolchain beta
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3340 次 |
| 最近记录: |