加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

ios – Xcode 6链接器错误 – 架构armv7的未定义符号

发布时间:2020-12-15 01:51:40 所属栏目:百科 来源:网络整理
导读:升级到Xcode 6 beta 7(现在仍然使用Xcode 6 GM)后,我无法链接我的Swift应用程序。我收到的错误如下: Undefined symbols for architecture armv7: “_swift_stdlib_compareNSStringDeterministicUnicodeCollation”,referenced from: … ld: symbol(s) not
升级到Xcode 6 beta 7(现在仍然使用Xcode 6 GM)后,我无法链接我的Swift应用程序。我收到的错误如下:

Undefined symbols for architecture armv7:
“_swift_stdlib_compareNSStringDeterministicUnicodeCollation”,referenced from:

ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我已经看到其他SO帖子建议删除Derived Data文件夹和/或使用Clean Build Folder选项来解决此错误,但在我的情况下,该解决方案根本没有帮助。关于我的代码或我正在使用的CocoaPods没有任何改变,因为Xcode 6 beta 5是它最后一次工作。

有任何想法吗?

编辑:

错误日志的完整发布:

Undefined symbols for architecture arm64:
“_swift_stdlib_compareNSStringDeterministicUnicodeCollation”,referenced from:
TFC12MyProject21BarcodeViewController13captureOutputfS0_FTGSQCSo15AVCaptureOutput_24didOutputMetadataObjectsGSQGSaPSs9AnyObject___14fromConnectionGSQCSo19AVCaptureConnection__T_ in BarcodeViewController.o
“__TFSs21_arrayConditionalCastU___FGSaQ__GSqGSaQ0_
“,referenced from:
TFC12MyProject27SessionsTableViewController17viewWillDisappearfS0_FSbT_ in SessionsTableViewController.o
“__TFSs15_arrayForceCastU___FGSaQ__GSaQ0
“,referenced from:
__TFC12MyProject7RestApi12tokenMappingfS0_FT_CSo15RKEntityMapping in RestApi.o
__TFC12MyProject28AttendeesTableViewControllerg24fetchedResultsControllerCSo26NSFetchedResultsController in AttendeesTableViewController.o
__TFC12MyProject27SessionsTableViewControllerg24fetchedResultsControllerCSo26NSFetchedResultsController in SessionsTableViewController.o
__TFC12MyProject21BarcodeViewController13startScanningfS0_FT_Sb in BarcodeViewController.o
“__TFSs26_forceBridgeFromObjectiveCU__FTPSs9AnyObject_MQ__Q_”,referenced from:
__TFC12MyProject7RestApi12resetRestKitfS0_FT_T_ in RestApi.o
__TFC12MyProject16BluetoothManager17_startAdvertisingfS0_FT_T_ in BluetoothManager.o
__TFC12MyProject19LoginViewController32registerForKeyboardNotificationsfS0_FT_T_ in LoginViewController.o
__TFC12MyProject19LoginViewController35deregisterFromKeyboardNotificationsfS0_FT_T_ in LoginViewController.o
__TFC12MyProject19LoginViewController16callProcessLoginfS0_FT_T_ in LoginViewController.o
__TFC12MyProject21CheckinViewController16enableBeaconModefS0_FT_T_ in CheckinViewController.o
__TFC12MyProject21BarcodeViewController13startScanningfS0_FT_Sb in BarcodeViewController.o

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

解决方法

这里发生的事情与您的派生数据位置无关。

构建swift应用程序时,它会经历几个步骤:

>编写辅助文件
>创建产品结构
>为每个架构编译swift源
>复制资源规则plist
>复制应用程序桥接标题
>链接每个体系结构的swift运行时库
>为每个架构复制应用程序swift模块
>创建应用程序二进制文件
>复制资源构建阶段
>将swift标准库复制到应用程序中
>打包它
>签名

呼!好多啊。链接swift运行时库时,您的构建失败。它们位于Xcode开发人员目录中的Toolchains / XcodeDefault.xctoolchain / usr / lib / swift / iphoneos中。具体来说,未正确链接的库是libswiftCore.dylib。如果在该库上使用nm,则可以看到它定义了您的第一个缺失符号:

quellish% nm /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib | grep compareNSStringDeterministicUnicodeCollation
00197c8c T _swift_stdlib_compareNSStringDeterministicUnicodeCollation
000000000018352c T _swift_stdlib_compareNSStringDeterministicUnicodeCollation

您还可以使用lipo查看文件中的架构:

quellish% xcrun lipo -info /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib
Architectures in the fat file: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos/libswiftCore.dylib are: armv7 arm64

它包含armv7和arm64。这不是图书馆架构的问题。

链接快速标准库是行不通的。源代码控制或迁移Xcode版本可能导致您的项目文件丢失了部分链接步骤,或者根本无法找到它需要链接的库。 Xcode项目文件很复杂并且使用了很多引用 – 合并等可能导致关键引用与链接步骤分离。如果没有完整的构建日志并查看您的计算机,则可能无法分辨。

正如您可能猜到的,该库与项目的派生数据位置无关。

不幸的是,前进的最佳方式是重新创建项目文件。将已损坏项目的构建日志与正确构建的快速项目进行比较可能会提供一些见解,但也可能浪费时间 – 可修复的问题可能是问题,但更有可能不是。

我鼓励你提交一个bug并用它包含麻烦的项目文件。

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读