38

After upgrading to Xcode 12, my project doesn't build for the simulator anymore.

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.

I already tried cleaning the build folder, updating pod file, restarting etc.

I'm using:

  • Firebase/Analytics (6.33.0)
  • Xcode 12.0.1 (12A7300)
  • CocoaPods: 1.9.3

Any ideas?

ricardopereira
  • 11,118
  • 5
  • 63
  • 81
themenace
  • 2,601
  • 2
  • 20
  • 33

10 Answers10

70

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"

Image of settings that need to be changed

Source and more elaborate explanation can be found here:
https://stackoverflow.com/a/64139830/4134160

Please note that the problem is not related to Firebase. I'll still leave it since it might lead others to this issue and help them to resolve this.

Apple Silicon

If you're running on an apple silicon chip, consider @Aspen's answer below: https://stackoverflow.com/a/65460729/4134160

themenace
  • 2,601
  • 2
  • 20
  • 33
  • 27
    This did not fix the issue when running on an Apple M1. – Adrienne Dec 24 '20 at 18:17
  • I would expect the error message in my question NOT to appear when using an M1 mac, since it's processor already has an arm64 architecture. Is it really the exact same error message? – themenace Dec 25 '20 at 14:10
  • 8
    I can confirm I also have this issue on M1 – Jacobo Koenig Dec 26 '20 at 13:57
  • 2
    @themenace Yes, same error message. I think it has to do with the fact that while the chip is an M1 arm64, the pod library itself (in this case Firebase Analytics) is not yet updated for M1. I was able to resolve the issue with my answer below. – Adrienne Dec 26 '20 at 21:09
  • 1
    @Aspen I see. Great that you've found a solution and added it here :) I'm unable to verify it since I don't own an M1 yet but I'm sure others will. – themenace Dec 28 '20 at 11:16
  • @themenace Yes, that resolved the build error! The app now runs in the simulator but unfortunately does not function properly as it did on an older Mac, so that is another problem I'm investigating. – Adrienne Dec 29 '20 at 17:05
  • 2
    Guys for M1 please check @Aspen's answer. – Mihir Oza May 31 '21 at 14:25
36

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.

I also had to clear the DerivedData folder and restart Xcode.

For more information, see: https://medium.com/@khushwanttanwar/xcode-12-compilation-errors-while-running-with-ios-14-simulators-5731c91326e9

ricardopereira
  • 11,118
  • 5
  • 63
  • 81
Adrienne
  • 2,540
  • 1
  • 29
  • 39
26

I fixed the issue by running xcode12 under Rosetta (Apple M1).

Open Finder -> Application -> locate Xcode -> right click -> get info -> check open using rosetta.

then reopen xcode.

VMSMani
  • 416
  • 4
  • 7
  • Please don't add the [same answer to multiple questions](http://meta.stackexchange.com/questions/104227/is-it-acceptable-to-add-a-duplicate-answer-to-several-questions). Answer the best one and flag the rest as duplicates, once you earn enough reputation. If it is not a duplicate, tailor the post to the question and flag for undeletion. – Bhargav Rao Jan 16 '21 at 10:09
  • 2
    OMG, this worked. What's this Rosetta? I was stuck because of her. Thank you. – Nehal Jaisalmeria Apr 12 '21 at 16:05
  • This `Rosetta` solution no longer work with Xcode 14.3 and above. [Read this](https://developer.apple.com/documentation/xcode-release-notes/xcode-14_3-release-notes) – Tommy Leong May 04 '23 at 14:39
11

My case was a little different. According to this Firebase engineer,

FIRAnalyticsConnector is now part of the xcframework version of FirebaseAnalytics and isn't needed to link.

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.

Interestingly, when I ran pod deintegrate and the pod install it did not fix this issue.

Ben
  • 3,346
  • 6
  • 32
  • 51
  • Just a complement for those who updated the Firebase pod like me, be sure you remove another deprecated frameworks from "Other Linker Flags" like FirebaseInstanceID. – Marcos Rocha Jan 21 '22 at 15:22
3

On my end, following the instruction from this link https://github.com/firebase/firebase-ios-sdk/blob/CocoaPods-7.2.0/AppleSilicon.md, solves it.

edie
  • 758
  • 1
  • 11
  • 29
2

Had same problem in Xcode v12.4 after running pod install.

After some searching inside my project I finally found reference to it under target's Build Phases in Link Binary With Libraries section. Removing FIRAnalyticsConnector.framework from the list solved my problem.

lacefarin
  • 1,018
  • 2
  • 13
  • 18
1

For Apple silicon machines I did this in order for the app to work on the simulator:

Please note that you go to PROJECT and not TARGETS.

Step 1: Go to your top project and then -> under PROJECT, add arm64 to Excluded Architectures enter image description here

Step 2: Go to Pods -> under PROJECT and add arm64 to Excluded Architectures enter image description here

fullmoon
  • 8,030
  • 5
  • 43
  • 58
0

remove -fraemwork "FIRAnalyticsConnector" from the list of from the TARGET -> "build settings" -> OTHER_LDFLAGS

kavehmb
  • 9,822
  • 1
  • 19
  • 22
0

if you run on Apple Silicone with new Macbook Pro M1 processor. This is a known issue.

Firebase not compiling on Apple Silicone

Emre Gürses
  • 1,992
  • 1
  • 23
  • 28
0

that worked. I open Xcode using Rosetta.

Step 1 - Installation

Homebrew(recommended)

brew install 417-72KI/tap/xcode-arch

Usage

$ 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
Omer Celikel
  • 55
  • 1
  • 4
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Vikram Parimi Sep 11 '22 at 12:18