[英]Xcode 12: build Error on FIRAnalyticsConnector
After upgrading to Xcode 12, my project doesn't build for the simulator anymore.升级到 Xcode 12 后,我的项目不再为模拟器构建。
The error I get is:我得到的错误是:
ld: in ... /Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(
FIRAnalyticsConnector_e321ed8e3db06efc9803f6c008e67a34.o),
building for iOS Simulator, but linking in object file built for iOS, file
'.../Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector'
for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
A workaround is adding arm64
to my project > Build Settings > Excluded Architectures, but then it won't build for my real device.一种解决方法是将arm64
添加到我的项目 > 构建设置 > 排除架构中,但它不会为我的真实设备构建。
I already tried cleaning the build folder, updating pod file, restarting etc.我已经尝试过清理构建文件夹、更新 pod 文件、重新启动等。
I'm using:我在用着:
Any ideas?有任何想法吗?
Ok, I finally found a fix for the issue.好的,我终于找到了解决该问题的方法。
Change "Build Active Architecture Only" to "Yes" also for "Release".对于“发布”,也将“仅构建活动架构”更改为“是”。
The setting can be found selecting your project > "Build Settings" > "Targets" (your target) > "Architectures"可以在选择您的项目>“构建设置”>“目标”(您的目标)>“架构”中找到该设置
Source and more elaborate explanation can be found here:来源和更详细的解释可以在这里找到:
https://stackoverflow.com/a/64139830/4134160 https://stackoverflow.com/a/64139830/4134160
Please note that the problem is not related to Firebase.请注意,该问题与 Firebase 无关。 I'll still leave it since it might lead others to this issue and help them to resolve this.我仍然会离开它,因为它可能会导致其他人解决这个问题并帮助他们解决这个问题。
I fixed the issue by running xcode12 under Rosetta (Apple M1).我通过在 Rosetta (Apple M1) 下运行 xcode12 解决了这个问题。
Open Finder -> Application -> locate Xcode -> right click -> get info -> check open using rosetta.打开 Finder -> 应用程序 -> 找到 Xcode -> 右键单击 -> 获取信息 -> 使用 rosetta 检查打开。
then reopen xcode.然后重新打开xcode。
After adding arm64
to Excluded Architectures
for the main project AND for the Pods project, I was able to resolve this issue I ran into on an Apple M1.将arm64
添加到主项目和 Pods 项目的Excluded Architectures
后,我能够解决我在 Apple M1 上遇到的这个问题。
I also had to clear the DerivedData
folder and restart Xcode.我还必须清除DerivedData
文件夹并重新启动 Xcode。
For more information, see: https://medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9有关更多信息,请参阅: https : //medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9
My case was a little different.我的情况有点不同。 According to this Firebase engineer ,根据这位 Firebase 工程师的说法,
FIRAnalyticsConnector
is now part of the xcframework version of FirebaseAnalytics and isn't needed to link.FIRAnalyticsConnector
现在是 FirebaseAnalytics 的 xcframework 版本的一部分,不需要链接。
Going into the Targets Build Settings
(not the Project), searching for Other Linker Flags
, and then deleting FIRAnalyticsConnector
from the list took care of the issue for me.进入目标Build Settings
(不是项目),搜索Other Linker Flags
,然后从列表中删除FIRAnalyticsConnector
为我解决了这个问题。
Interestingly, when I ran pod deintegrate
and the pod install
it did not fix this issue.有趣的是,当我运行pod deintegrate
和pod install
它并没有解决这个问题。
Had same problem in Xcode v12.4
after running pod install
.运行pod install
后在Xcode v12.4
同样的问题。
After some searching inside my project I finally found reference to it under target's Build Phases
in Link Binary With Libraries
section.在我的项目中进行了一些搜索之后,我终于在Link Binary With Libraries
部分的目标的Build Phases
下找到了对它的引用。 Removing FIRAnalyticsConnector.framework
from the list solved my problem.从列表中删除FIRAnalyticsConnector.framework
解决了我的问题。
从目标列表中删除 -fraemwork "FIRAnalyticsConnector" -> "build settings" -> OTHER_LDFLAGS
if you run on Apple Silicone with new Macbook Pro M1 processor.如果您在配备新 Macbook Pro M1 处理器的 Apple Silicone 上运行。 This is a known issue.这是一个已知的问题。
Firebase not compiling on Apple Silicone Firebase 未在 Apple Silicone 上编译
that worked.那行得通。 I open Xcode using Rosetta.我使用 Rosetta 打开 Xcode。
brew install 417-72KI/tap/xcode-arch
$ xcode-arch -p
arm64 # `Open using Rosetta` is off
$ xcode-arch -c
Set x86_64 for /Applications/Xcode.app
$ xcode-arch -p
x86_64 # `Open using Rosetta` is on
$ xcode-arch -u
Set arm64 for /Applications/Xcode.app
$ xcode-arch -p
arm64 # `Open using Rosetta` is off
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.