如何在iOS上使用rust-openssl?

问题描述

我正在尝试生成带有rust-openssl的RSA密钥对:Rsa::generate(4096)

[dependencies]
openssl = { version = "0.10.30",features = ["vendored"] }

这是我的构建脚本:

#!/bin/bash

# Ensure that `cargo` is in PATH,using the default location.
export PATH="$PATH:${HOME}/.cargo/bin"

# This obvIoUsly doesn't work for the app,only to build on desktop.
export OPENSSL_DIR="/usr/local/opt/openssl"

set -x

# Go to repo's root
cd "${SRCROOT}/../"

# Build binaries
RUSTFLAGS="-Z embed-bitcode" cargo +ios-arm64 build --target aarch64-apple-ios --release --lib
cargo build --target=x86_64-apple-ios --release

# Create fat binary
libtool -static -o ./ios_app/core/libcore ./target/aarch64-apple-ios/release/libcore.a ./target/x86_64-apple-ios/release/libcore.a

应用程序链接时,失败:

+ RUSTFLAGS='-Z embed-bitcode'
+ cargo +ios-arm64 build --target aarch64-apple-ios --release --lib
   Compiling openssl v0.10.30
   Compiling openssl-sys v0.9.58
error: linking with `cc` Failed: exit code: 1
.....
.....
.....
  = note: ld: library not found for -lSystem
          clang: error: linker command Failed with exit code 1 (use -v to see invocation)
          
error: aborting due to prevIoUs error
error: Could not compile `openssl`.

According to the docs,对于供应的OpenSSL,我需要一个C编译器,perl并进行安装:

如果启用了供应商提供的货运功能,则将使用openssl-src板条箱编译并静态链接到OpenSSL副本。构建过程需要C编译器,perl和make。

我检查了:gccperlmake在终端中运行。 xcode工具似乎也已安装。

我还运行了brew updatebrew upgrade gcc在这里我得到gcc 10.2.0 already installed)(尽管这应该由xcode工具提供)。

有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)