我在我的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"]运行cargo +beta build时出现以下错误:
error[E0463]: can't find crate for `core`
|
= note: the `i686-pc-windows-msvc` target may not be installed我试着运行rustup target add i686-pc-windows-msvc来解决这个问题,但是没有帮助;rustup target list甚至显示它为“已安装”。可能这个命令只添加了稳定的目标,而我找不到如何指定beta工具链。
如何为beta工具链添加另一个(非默认)目标?
发布于 2018-11-08 22:52:22
阅读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`因此,您需要:
rustup target add i686-pc-windows-msvc --toolchain beta我相信默认情况下它会将目标添加到“当前”工具链中,所以你也可以这样做:
rustup override set beta # in your project directory
rustup target add i686-pc-windows-msvc #
cargo build # no more +beta
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`因此,您需要:
rustup target list --toolchain betahttps://stackoverflow.com/questions/53210121
复制相似问题