The output of rustup target list --toolchain nightly
does not contain x86_64-apple-ios-macabi
, even though it is in src/librustc_target
on the Rust master branch.
How do I build for Mac Catalyst / x86_64-apple-ios-macabi
?
The output of rustup target list --toolchain nightly
does not contain x86_64-apple-ios-macabi
, even though it is in src/librustc_target
on the Rust master branch.
How do I build for Mac Catalyst / x86_64-apple-ios-macabi
?
该x86_64-apple-ios-macabi
目标在 nightly (5c5b8afd8 2019-11-16) 编译器上可用。仅仅因为目标可用并不意味着标准库和朋友已编译或可用于 rustup:
% rustc +nightly --print target-list | grep macabi
x86_64-apple-ios-macabi
Rust 有一个分层系统(这是提议的 RFC的主题)。这个目标太新了,甚至没有在等级列表中列出,但毫无疑问它将成为等级 3。等级 2.5 说(强调我的):
2.5 层平台可以被认为是“保证构建”,但没有通过 rustup 提供的构建
同时,您需要从源代码构建自己的 libcore / libstd。我没有时间也没有能力实际测试编译是否有效,但这些选择是一般的起始路径:
不稳定-Z build-std
标志可用于构建标准库:
% cargo +nightly build -Z build-std --target x86_64-apple-ios-macabi
可以使用xargo工具构建标准库。
% rustup override set nightly
info: using existing install for 'nightly-x86_64-apple-darwin'
info: override toolchain for '/private/tmp/example' set to 'nightly-x86_64-apple-darwin'
nightly-x86_64-apple-darwin unchanged - rustc 1.41.0-nightly (5c5b8afd8 2019-11-16)
% cat > Xargo.toml
[target.x86_64-apple-ios-macabi.dependencies.std]
# features = ["jemalloc"] # Whatever is appropriate
% xargo build --target x86_64-apple-ios-macabi
# Iterate until libcore and libstd compile and work for your platform
@shepmaster 的回答是正确的。详细地说,您必须:
cargo install xargo
cd 在你的项目中
使用几乎构建:
rustup override set nightly
Xargo.toml
包含内容的文件:[target.x86_64-apple-ios-macabi.dependencies.std]
在您的项目 Cargo.toml 中,确保该[profile.release]
部分包含panic = "abort"
. 如果没有,请添加它。
构建项目时,使用xargo
而不是cargo
.
Shepmaster的回答有点过时了。Cargo 现在支持该-Zbuild-std
命令。使用它,您可以定位任何rustc
本身支持的目标,即使它们未列在rustup +nightly target list
. 简单地:
rustc +nightly --print target-list
和
cargo +nightly build -Z build-std --target x86_64-apple-ios-macabi
现在应该够了。您不再需要xargo
构建标准库。
如果你有旧的 rust 安装,你可能需要每晚删除旧的(或者至少对我来说它无法每晚更新):
rustup toolchain remove nightly
rustup update
rustup toolchain install nightly