简体   繁体   English

链接到 Xcode 上的 arm64 库时出现链接器错误

[英]linker error while linking to arm64 library on Xcode

I'm trying to build my project for arm64.我正在尝试为 arm64 构建我的项目。 This project requires an arm64 libcrypto.a.这个项目需要一个 arm64 libcrypto.a。 I'd like to know if I'm missing any settings.我想知道我是否缺少任何设置。 Thanks in advance...提前致谢...

The error I see is:我看到的错误是:

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

My project settings are shown below:我的项目设置如下所示:

Architectures: arm64
Base SDK: Latest iOS(iOS 11.4)
Build Active Architecture Only: No
Supported Platforms: iOS
Valid Architectures: arm64

I've updated "RequiredDeviceCapabilities" in info.plist to arm64.我已将 info.plist 中的“RequiredDeviceCapabilities”更新为 arm64。
I've checked the type of library I'm trying to link with:我检查了我试图链接的库类型:

[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

I fail to understand why the error says the project is being built for x86_64.我不明白为什么错误说该项目是为 x86_64 构建的。

Looks like OpenSSL has some issues with multi-arch builds that you need to address for it to work, the answer here Build Multiarch OpenSSL on OS X should help.看起来 OpenSSL 在多架构构建方面存在一些问题,您需要解决这些问题才能使其正常工作,此处在 OS X 上构建多架构 OpenSSL的答案应该会有所帮助。

Essentially, you'll have to replace a couple of the OpenSSL header files that include the architecture-specific header using #ifdef to check the system architecture at compile time.本质上,您必须使用#ifdef替换几个包含特定于体系结构的头文件的 OpenSSL 头文件,以在编译时检查系统体系结构。 Do this after building OpenSSL from source for each target that you want.在从源为您想要的每个目标构建 OpenSSL 之后执行此操作。 Then you'll be able to use the lipo tools to combine each target's static library build for OpenSSL into one static library, then use that.然后您将能够使用lipo工具将每个目标的 OpenSSL 静态库构建合并到一个静态库中,然后使用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 xcode5构建ios arm64静态库,构建程序集文件时出错 - xcode5 build ios arm64 static library, error when building the assembly file Xcode:MagTek iOS库中缺少arm64符号 - Xcode: Missing arm64 Symbols from MagTek iOS Library Xcode将.a库文件转换为支持arm64的.a文件 - Xcode Convert .a library file to arm64 arch supportive .a file 在模拟器上编译 Xcode 12.2 中的 cordova 代码时,MFP 出现 arm64 错误 - While compile on simulator the cordova code in Xcode 12.2 with MFP getting error for arm64 Xcode 错误“为 iOS 模拟器构建,但在为 iOS.. 构建的 dylib 中链接”来自 Apple Silicon M1 Mac - Xcode error 'building for iOS Simulator, but linking in dylib built for iOS .. for architecture arm64' from Apple Silicon M1 Mac Xcode:架构 arm64 错误的未定义符号 - Xcode: Undefined symbols for architecture arm64 error 架构arm64错误的未定义符号是什么? iOS Xcode - what is this Undefined symbols for architecture arm64 error? ios xcode xcode显示错误的体系结构arm64未定义符号: - xcode shows the error Undefined symbols for architecture arm64: FFmpeg libavcodec.a Xcode链接器问题 - 架构arm64的未定义符号 - FFmpeg libavcodec.a Xcode linker issues - Undefined symbols for architecture arm64 Unity 4.6.6 Xcode'armv7 / arm64体系结构的未定义符号'链接器错误 - Unity 4.6.6 Xcode 'Undefined symbol for armv7/arm64 architecture' linker errors
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM