Skip to content

ARM64 Simulator support #6520

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
imWildCat opened this issue Sep 22, 2020 · 50 comments
Closed

ARM64 Simulator support #6520

imWildCat opened this issue Sep 22, 2020 · 50 comments

Comments

@imWildCat
Copy link

Step 0: Are you in the right place?

  • For issues or feature requests related to the code in this repository
    file a Github issue.
    • If this is a feature request please use the Feature Request template.
  • For general technical questions, post a question on StackOverflow
    with the firebase tag.
  • For general (non-iOS) Firebase discussion, use the firebase-talk
    google group.
  • For backend issues, console issues, and other non-SDK help that does not fall under one
    of the above categories, reach out to
    Firebase Support.
  • Once you've read this section and determined that your issue is appropriate for
    this repository, please delete this section.

[REQUIRED] Step 1: Describe your environment

  • Xcode version: Version 12.0 (12A7209)
  • Firebase SDK version: added below
  • Firebase Component: added below
  • Component version: added below
  • Installation method: CocoaPods (select one)
  - Firebase (6.32.2):
    - Firebase/Core (= 6.32.2)
  - Firebase/ABTesting (6.32.2):
    - Firebase/CoreOnly
    - FirebaseABTesting (~> 4.2.0)
  - Firebase/Analytics (6.32.2):
    - Firebase/Core
  - Firebase/Core (6.32.2):
    - Firebase/CoreOnly
    - FirebaseAnalytics (= 6.8.2)
  - Firebase/CoreOnly (6.32.2):
    - FirebaseCore (= 6.10.2)
  - Firebase/Crashlytics (6.32.2):
    - Firebase/CoreOnly
    - FirebaseCrashlytics (~> 4.6.0)
  - Firebase/RemoteConfig (6.32.2):
    - Firebase/CoreOnly
    - FirebaseRemoteConfig (~> 4.9.0)
  - FirebaseABTesting (4.2.0):
    - FirebaseCore (~> 6.10)
  - FirebaseAnalytics (6.8.2):
    - FirebaseCore (~> 6.10)
    - FirebaseInstallations (~> 1.6)
    - GoogleAppMeasurement (= 6.8.2)
    - GoogleUtilities/AppDelegateSwizzler (~> 6.7)
    - GoogleUtilities/MethodSwizzler (~> 6.7)
    - GoogleUtilities/Network (~> 6.7)
    - "GoogleUtilities/NSData+zlib (~> 6.7)"
    - nanopb (~> 1.30906.0)
  - FirebaseCore (6.10.2):
    - FirebaseCoreDiagnostics (~> 1.6)
    - GoogleUtilities/Environment (~> 6.7)
    - GoogleUtilities/Logger (~> 6.7)
  - FirebaseCoreDiagnostics (1.6.0):
    - GoogleDataTransport (~> 7.2)
    - GoogleUtilities/Environment (~> 6.7)
    - GoogleUtilities/Logger (~> 6.7)
    - nanopb (~> 1.30906.0)
  - FirebaseCrashlytics (4.6.0):
    - FirebaseCore (~> 6.10)
    - FirebaseInstallations (~> 1.6)
    - GoogleDataTransport (~> 7.2)
    - nanopb (~> 1.30906.0)
    - PromisesObjC (~> 1.2)
  - FirebaseInstallations (1.7.0):
    - FirebaseCore (~> 6.10)
    - GoogleUtilities/Environment (~> 6.7)
    - GoogleUtilities/UserDefaults (~> 6.7)
    - PromisesObjC (~> 1.2)
  - FirebaseRemoteConfig (4.9.0):
    - FirebaseABTesting (~> 4.2)
    - FirebaseCore (~> 6.10)
    - FirebaseInstallations (~> 1.6)
    - GoogleUtilities/Environment (~> 6.7)
    - "GoogleUtilities/NSData+zlib (~> 6.7)"

[REQUIRED] Step 2: Describe the problem

Steps to reproduce:

Create a minimal demo project on arm Mac, cannot build this project.

ld: in /Users/myusername/Downloads/202009/temp/My_Project/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_e321ed8e3db06efc9803f6c008e67a34.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/myusername/Downloads/202009/temp/My_Project/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64

Relevant Code:

None.

// TODO(you): code here to reproduce the problem
@imWildCat
Copy link
Author

@ryanwilson could you help to prioritize this issue? It can be consistently reproduced, even if the version is 7.0:

ld: in /Users/username/Downloads/202011/temp/My_Project/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/username/Downloads/202011/temp/My_Project/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64

@ryanwilson
Copy link
Member

Hi @imWildCat - thanks for the report. This is definitely top of mind as we're expecting the first Apple silicon Macs to be announced next week, the plan is to have something ASAP and included in the next release or two (likely not next release though at this point).

@imWildCat
Copy link
Author

@ryanwilson thanks for your prompt reply! Really appreciate your efforts!

@bencIsTheGoat
Copy link

bencIsTheGoat commented Nov 6, 2020

@imWildCat this stackoverflow comment helped me fix this issue

@imWildCat
Copy link
Author

imWildCat commented Nov 8, 2020

@bcutler94 Great, thank you!

Update: this looks like a workaround?

@douglashill
Copy link

@ryanwilson sorry if this is slightly off topic for this issue, but do your current plans include support for arm64 for Mac Catalyst apps too? Happy to open a new issue if that would help to track this.

@Bjornftw
Copy link

Same issue here with the new M1 Silicon MacBook. Hope there will be a fix soon

@ryanwilson
Copy link
Member

I have a PR open (#6950) that should land today and we're going to try to package a release as soon as we can for support. I also have an M1 Mac hopefully arriving today that I can test with. Thanks for your patience while we get this resolved!

@jeremiahjoven
Copy link

Same here, stackOverflow fix didn't work on M1 Mac

@paulb777 paulb777 added this to the 7.2.0 - M84 milestone Nov 18, 2020
@asowers1
Copy link

I realize that this is off topic, but does anyone know if GoogleSignIn will get a similar treatment soon? https://developers.google.com/identity/sign-in/ios/sdk

@paulb777
Copy link
Member

@asowers1 We've had conversations with the GoogleSignIn team and they're working on it, but I'm not up-to-date on the schedule.

@jeremiahjoven
Copy link

Any update on this fix?

@paulb777
Copy link
Member

We're were hoping to get it out this week, but ran into a CocoaPods bug that will likely force us to split the Arm64 simulator support into a separate CocoaPod that will probably push it until sometime next week.

@alexiscreuzot
Copy link

Thanks @paulb777, hopefully CocoaPods will merge the PR soon!

@paulb777
Copy link
Member

Yep, hopefully the fix will land soon. Either way, we're planning to do a workaround with product structure and documentation in the meantime and to avoid requiring all Firebase users to update their CocoaPods version.

@Bjornftw
Copy link

Bjornftw commented Nov 29, 2020

For everyone with an M1 (Silicon) device who want run their projects on a simulator:
Set arm64 as excluding architecture for Any iOS Simulator SDK.

Screenshot 2020-11-29 at 16 35 53

@gohnjanotis
Copy link

gohnjanotis commented Nov 29, 2020

I just want to point out that (at least in my case) I had to add arm64 to Excluded Architectures on the Pods project in my Workspace to get it to build for a simulator (without building for a real device connected to my computer).

Previously, I was using this workaround by just adding it to my main app project, but that wasn't enough now that I'm on an Apple Silicon Mac. Maybe this is obvious, but I wanted to point it out in case anyone else is having the same issue.

@skuske
Copy link

skuske commented Nov 30, 2020

Previously, I was using this workaround by just adding it to my main app project, but that wasn't enough now that I'm on an Apple Silicon Mac. Maybe this is obvious, but I wanted to point it out in case anyone else is having the same issue.

Thanks, that really helped a lot and quite a few Xcode errors disappeared now, but iOS 14 Widgets still do not preview in the canvas on an M1 - Xcode says

ProcessError: Failed to launch widget extension: The operation couldn’t be completed. (CHSErrorDomain error 1050.)

Maybe this is not directly related. Those cryptic Xcode error message really don't help at all.

@jeremiahjoven
Copy link

Adding arm64 to excluded architectures causes conflicts with other Pods I have on my project, so a fix for Firebase is still very much needed.

Error: 
/Users/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector(FIRAnalyticsConnector_a8eeba373b74508311b8b22b8d3202a6.o), building for iOS Simulator, but linking in object file built for iOS, file '/Users/Pods/FirebaseAnalytics/Frameworks/FIRAnalyticsConnector.framework/FIRAnalyticsConnector' for architecture arm64

@ryanwilson
Copy link
Member

Hi everyone,

Thanks for your patience. We ran into a few hiccups along the way, but just published a version of Analytics and Perf that are compatible with Apple Silicon.

Perf: update to 7.2.0 and you're good to go. Requires CocoaPods 1.10.0 since it has some important xcframework fixes.
Analytics: Please read our Apple silicon doc in our repo for instructions. We had to ship a separate version for now since there's a different CocoaPods bug we ran into.

I'll close this now but if you run into issues with the instructions or running on Apple silicon machines, please file a new bug!

@ryanwilson
Copy link
Member

Agh, looks like the instructions don't quite work as expected for locking to minor versions. I'll get that addressed in the morning.

In the meantime, you can lock to the exact version (remove ~> in the version string) and that should work, I just tested that locally.

Sorry about that!

@jeremiahjoven
Copy link

Thank you! That did the job @ryanwilson

@skuske
Copy link

skuske commented Dec 3, 2020

After following the instructions above I am now getting a build error:

framework not found FIRAnalyticsConnector

@DominikButz
Copy link

DominikButz commented Dec 3, 2020

My project which has Firebase dependencies runs fine on a physical device. To make it run in the simulator, I have to run Xcode with Rosetta 2.
What I don't quite grasp (maybe someone can enlighten me): the Simulator should run on the arm64 architecture on an M1 mac, right? So why do I have to exclude arm64 in my project for the iOS Simulator if I run it on an M1 mac? It makes sense if Xcode (and probably the simulator) run in Rosetta 2 and also if Xcode is running on an Intel Mac - because then the instructions for x86 are executed.

@mhamzasani
Copy link

I realize that this is off topic, but does anyone know if GoogleSignIn will get a similar treatment soon? https://developers.google.com/identity/sign-in/ios/sdk

I'm having the same issue on M1 with Google Sign In.

@ryanwilson
Copy link
Member

After following the instructions above I am now getting a build error:

framework not found FIRAnalyticsConnector

I'm unable to reproduce this, can you try cleaning your build folder and trying again? If you can reliably reproduce this, let me know how and I'll see if I can do the same.

@ryanwilson
Copy link
Member

ryanwilson commented Dec 3, 2020

My project which has Firebase dependencies runs fine on a physical device. To make it run in the simulator, I have to run Xcode with Rosetta 2.
What I don't quite grasp (maybe someone can enlighten me): the Simulator should run on the arm64 architecture on an M1 mac, right? So why do I have to exclude arm64 in my project for the iOS Simulator if I run it on an M1 mac? It makes sense if Xcode (and probably the simulator) run in Rosetta 2 and also if Xcode is running on an Intel Mac - because then the instructions for x86 are executed.

Sorry for the troubles - are you using CocoaPods? If so, did you try the new instructions? If you're still having issues after trying that out, please let us know and we can help further.

@ryanwilson
Copy link
Member

I realize that this is off topic, but does anyone know if GoogleSignIn will get a similar treatment soon? https://developers.google.com/identity/sign-in/ios/sdk

I'm having the same issue on M1 with Google Sign In.

Thanks for the report, Google Sign In still hasn't migrated to XCFrameworks. I'll reach out to the team again to discuss migrating.

@mhamzasani
Copy link

I realize that this is off topic, but does anyone know if GoogleSignIn will get a similar treatment soon? https://developers.google.com/identity/sign-in/ios/sdk

I'm having the same issue on M1 with Google Sign In.

Thanks for the report, Google Sign In still hasn't migrated to XCFrameworks. I'll reach out to the team again to discuss migrating.

Thank you!

@skuske
Copy link

skuske commented Dec 3, 2020

After following the instructions above I am now getting a build error:
framework not found FIRAnalyticsConnector

I'm unable to reproduce this, can you try cleaning your build folder and trying again? If you can reliably reproduce this, let me know how and I'll see if I can do the same.

@ryanwilson

No luck. I cleaned the build folder, deleted DerivedData, build: same error. I then cleaned the build folder again, deleted DerivedData, closed Xcode. I ran pod deintegrate, pod install, build: same error:

error

@paulb777
Copy link
Member

paulb777 commented Dec 3, 2020

FIRAnalyticsConnector is now part of the xcframework version of FirebaseAnalytics and isn't needed to link. It's likely you have a lingering reference to it in the Xcode project. Please search and remove it.

@skuske
Copy link

skuske commented Dec 3, 2020

It's likely you have a lingering reference to it in the Xcode project. Please search and remove it.

That was it. Many thanks! :o)

@skuske
Copy link

skuske commented Dec 4, 2020

@DominikButz

Correct link is https://github.com/firebase/firebase-ios-sdk/blob/master/AppleSilicon.md

@skuske
Copy link

skuske commented Dec 4, 2020

Maybe a stupid question, but: now that v7.2.0 adds arm64 simulator support, does that mean that we can now remove arm64 from EXCLUDED_ARCHS again?

@DominikButz
Copy link

DominikButz commented Dec 4, 2020

Thanks for the hint. yes, I'm using cocoapods. However I can't open that new instructions link, Safari is just showing an empty page. In the meantime, I set up a test project to see if it builds without Rosetta 2 on M1. And it finally did build. Below is the content of my pod file. Important: I did not include the post install command adding the arm64 exclusion for iOS Simulator for each pod. And I did neither add it to the pods project nor to my test project. That seems logical - maybe I misunderstood some remarks in this issue thread.
My actual project is still not building without Rosetta 2, but now I can rule out that any of the Firebase pods is the culprit. I'm still having problems with some dependencies I use through the SPM...

Anyway, thanks for your quick reaction publishing these M1 updates.

platform :ios, '14.0'
target 'Xcode 12 Test' do
use_frameworks!
pod 'Firebase', '7.2-M1'
pod 'Firebase/Firestore', '> 7.2-M1'

pod 'FirebaseFirestoreSwift', '7.2-beta'

pod 'FirebaseStorage', '> 7.2.0-M1'
pod 'Firebase/Auth', '> 7.2.0-M1'

pod 'Firebase/Crashlytics', '> 7.2-M1'
pod 'Firebase/Analytics', '~> 7.2-M1'
end

@DominikButz
Copy link

Maybe a stupid question, but: now that v7.2.0 adds arm64 simulator support, does that mean that we can now remove arm64 from EXCLUDED_ARCHS again?

yes, that is exactly my experience. You have to remove exclude arm64 for iOS Simulator: not only for each pod but also for your project and the pods project. See my post above. And it makes sense because now iOS simulator can basically run like on the iPhone with the arm64 instructions.

@randyhill
Copy link

My project which has Firebase dependencies runs fine on a physical device. To make it run in the simulator, I have to run Xcode with Rosetta 2.
What I don't quite grasp (maybe someone can enlighten me): the Simulator should run on the arm64 architecture on an M1 mac, right? So why do I have to exclude arm64 in my project for the iOS Simulator if I run it on an M1 mac? It makes sense if Xcode (and probably the simulator) run in Rosetta 2 and also if Xcode is running on an Intel Mac - because then the instructions for x86 are executed.

Sorry for the troubles - are you using CocoaPods? If so, did you try the new instructions? If you're still having issues after trying that out, please let us know and we can help further.

Where are these new instructions? That link is broken.

@ryanwilson
Copy link
Member

ryanwilson commented Dec 7, 2020

@darrenp2022a
Copy link

With SPM same issue, I also tried removing package and re-adding. I'm not able to use ARM64 due to another package breaking.

FYI, If I try using 7.2.0-M1 then I get an error installing the package when I get to analytics (because this wasn't in that branch.

FYI, if you open Xcode under rosetta things work, obviously slower

@ericpapamarcos
Copy link

Thanks for the report, Google Sign In still hasn't migrated to XCFrameworks. I'll reach out to the team again to discuss migrating.

@ryanwilson What's the best way to track status of Apple Silicon Simulator support for the Google Sign-In SDK?

@jeremyfrancis
Copy link

Find Xcode in Finder and press CMD+I and select the application to open with Rosetta 2. I did the same for my Terminal. This fixed all my issues with my new Mac mini M1 chip!

@darrenp2022a
Copy link

Find Xcode in Finder and press CMD+I and select the application to open with Rosetta 2. I did the same for my Terminal. This fixed all my issues with my new Mac mini M1 chip!

This doesn't fix the issue :), its a work around I mentioned above, but this makes Xcode run much slower. For me, I have the beta Xcode running as native M1, and prod Xcode running with Rosetta (I have disabled analytics in most of my projects except one that requires it)

@paulb777
Copy link
Member

@jeremyfrancis @darrenpedley No work arounds should be necessary if you follow the instructions at https://github.com/firebase/firebase-ios-sdk/blob/master/AppleSilicon.md

@darrenp2022a
Copy link

@jeremyfrancis @darrenpedley No work arounds should be necessary if you follow the instructions at https://github.com/firebase/firebase-ios-sdk/blob/master/AppleSilicon.md

@paulb777 I have followed the instructions referenced, and get the same issue as described, the work around listed is the only way to compile.

FYI I'm using:
Latest Xcode and Xcode beta
SPM with Firebase 7.3.1 (updated today)
ZIP 2.1.1

Analytics causes the error, using excluded arm64 allows compilation, however, ZIP breaks. The workaround above (i.e. using Rosetta) allows compilation without using excluded arm64.

@paulb777
Copy link
Member

@darrenpedley What does ZIP 2.1.1 mean? The Analytics included in 7.3.1 includes a slice for the arm64 simulator? Are you trying Catalyst? If so, that's a separate issue - #7043

@darrenp2022a
Copy link

#7043

@paulb777 Zip 2.1.1 is a different SPM package, that doesn't support the excluded Arm64, not related to Firebase, but .
No I'm not using catalyst, this is purely a iOS iPhone / iPad app.

This is the error I get

Undefined symbols for architecture arm64:
"OBJC_CLASS$_FIRAnalytics", referenced from:

If I remove Analytics, issue goes away,
If I open Xcode using rosetta issue goes away

@darrenp2022a
Copy link

Hi,

I'm pretty sure I deleted my DerivedData folder before but looks like cleaning that up, rebooting and clean build has resolved my issue, no longer have to start in Rosetta, etc.

Thanks for feedback and assistance.

@firebase firebase locked and limited conversation to collaborators Jan 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests