我正在尝试为arm64构建我的项目。该项目需要arm64 libcrypto.a。我想知道是否缺少任何设置。预先感谢...
我看到的错误是:
ld: warning: ignoring file /Users/Amy/Desktop/swift_proj/swift_proj/include/libcrypto.a, file was built for archive which is not the architecture being linked (x86_64): /Users/Amy/Desktop/swift_proj/swift_proj/include/libcrypto.a
我的项目设置如下所示:
Architectures: arm64
Base SDK: Latest iOS(iOS 11.4)
Build Active Architecture Only: No
Supported Platforms: iOS
Valid Architectures: arm64
我已将info.plist中的“ RequiredDeviceCapabilities”更新为arm64。我检查了要链接的库的类型:
[Amys-MacBook-Air:include$ lipo -info libcrypto.a
input file libcrypto.a is not a fat file
Non-fat file: libcrypto.a is architecture: arm64
我不明白为什么该错误说明该项目是针对x86_64构建的。
看起来像OpenSSL的多体系结构有一些问题,您需要解决才能使其正常工作,这里的答案Build Multiarch OpenSSL on OS X应该会有所帮助。
基本上,您必须使用#ifdef
替换几个包含特定于体系结构的头文件的OpenSSL头文件,以在编译时检查系统体系结构。从源构建所需的每个目标的OpenSSL之后执行此操作。然后,您将能够使用lipo
工具将每个目标针对OpenSSL的静态库构建组合到一个静态库中,然后使用它。