簡體   English   中英

鏈接到 Xcode 上的 arm64 庫時出現鏈接器錯誤

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

我正在嘗試為 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 在多架構構建方面存在一些問題,您需要解決這些問題才能使其正常工作,此處在 OS X 上構建多架構 OpenSSL的答案應該會有所幫助。

本質上,您必須使用#ifdef替換幾個包含特定於體系結構的頭文件的 OpenSSL 頭文件,以在編譯時檢查系統體系結構。 在從源為您想要的每個目標構建 OpenSSL 之后執行此操作。 然后您將能夠使用lipo工具將每個目標的 OpenSSL 靜態庫構建合並到一個靜態庫中,然后使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM