简体   繁体   English

Xcode 构建失败,架构 arm64 的未定义符号:

[英]Xcode build fails with Undefined symbols for architecture arm64:

I got the following warning on Github CI when trying to build an iOS archive:尝试构建 iOS 存档时,我在 Github CI 上收到以下警告:

ld: warning: ignoring file ios/myframework.xcframework/ios-arm64/myframework.framework/myframework, building for iOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F )

then this error followed:然后这个错误随之而来:

Undefined symbols for architecture arm64:

Now the confusing thing is that this error can happen because of several reasons, in my case, it was neither of any I could find online.现在令人困惑的是,这个错误的发生可能有多种原因,就我而言,我在网上找不到任何一个。

After hours of debugging I was able to figure out that the unknown-unsupported file format warning appeared because I was using Git LFS for the framework's binary.经过数小时的调试,我发现出现了未知不受支持的文件格式警告,因为我使用 Git LFS 作为框架的二进制文件。 Git LFS replaces the binary with a text pointer. Git LFS 用文本指针替换二进制文件。 When Xcode was trying to build my archive on the CI, it didn't pull the binary from LFS, hence the string pointer remained at ios/myframework.xcframework/ios-arm64/myframework.framework/myframework .当 Xcode 尝试在 CI 上构建我的存档时,它没有从 LFS 中提取二进制文件,因此字符串指针保留在ios/myframework.xcframework/ios-arm64/myframework.framework/myframework Make sure to pull your large binaries from LFS before trying to setup an Xcode build on the CI or you might see some not-so-easy-to-debug issues like this.在尝试在 CI 上设置 Xcode 构建之前,请确保从 LFS 中提取大型二进制文件,否则您可能会看到一些像这样不太容易调试的问题。

So the solution was actually as easy as running git lfs pull before trying to build the archive, and voilá, the error was gone.所以解决方案实际上就像在尝试构建存档之前运行git lfs pull一样简单,瞧,错误消失了。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM