【发布时间】:2021-06-11 22:14:03
【问题描述】:
无法使用 cargo lipo --release 构建库
我正在尝试使用 rust 为 ios 目标创建一个跨平台库。我正在关注这篇文章(Building and Deploying a Rust library on iOS)。 *注意:我遵循相同的步骤,我的项目结构也看起来相同 *
完成代码和项目设置后,最后一步是构建库。当我尝试使用cargo lipo --release 构建库时。它抛出这个错误:
[ERROR cargo_lipo] No library target found for "my-project-name"
另外,请注意,我只能安装对两个平台的支持。 (aarch64-apple-ios 和 x86_64-apple-darwin)。我认为原因是他们有dropped the support for 32-bit architectures。
所以,当我跑步时
rustup target add aarch64-apple-ios armv7-apple-ios armv7s-apple-ios x86_64-apple-ios i386-apple-ios.
它抛出错误:error: component 'rust-std' for target 'armv7-apple-ios' is unavailable for download for channel stable
Cargo.toml
[package]
name = "rustylib"
version = "0.1.0"
edition = "2018"
crate-type = ["staticlib", "cdylib"]
rustylib.rs
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
char *hello(const char *to);
void hello_release(char *s);
项目结构的其余部分是通常的 rust 代码。
rustupshow 的输出
默认主机:x86_64-apple-darwin rustup 主页:/Users/my-username/.rustup
已安装的工具链
stable-x86_64-apple-darwin
nightly-x86_64-apple-darwin(默认)
活动工具链的安装目标
aarch64-apple-ios
x86_64-apple-darwin
活动工具链
nightly-x86_64-apple-darwin(默认)
rustc 1.52.0-nightly (acca81892 2021-03-13)
操作系统和锈
Rust:rustc 1.50.0 (cb75ad5db 2021-02-10)
操作系统:macOS Bug Sur (11.2.3)
Xcode 和命令行工具:12.4
【问题讨论】:
标签: ios rust rust-cargo