firebase / firebase-ios-sdk

Firebase SDK for Apple App Development
https://firebase.google.com
Apache License 2.0
5.69k stars 1.49k forks source link

Xcode 15: Segmentation fault on launch for Firebase 10.8.0+ #11413

Closed ncooke3 closed 1 year ago

ncooke3 commented 1 year ago

Description

Deploying an app that uses Firestore 10.8.0+ onto a physical device is failing to launch with a segmentation fault.

Additional context here and below.

What we know...

If you are seeing behavior that contradicts the below points, please leave a comment with what you're seeing.

Related Threads

Workaround

Until a solution is found, please revert to using Firebase 10.7.0– apologies for the inconvenience.


Please give this post a thumbs up if you are being affected by this issue.

JamieShaneRainbird commented 1 year ago

Having the same issue, I can run the simulator on my Mac but can't run on my iPhone development device.

ncooke3 commented 1 year ago

Thanks @JamieShaneRainbird, is this affecting only when you deploy to iOS 17 or other versions too?

JamieShaneRainbird commented 1 year ago

Hi @ncooke3, it is affecting the deployment for all versions.

ncooke3 commented 1 year ago

Got it, thank you. Using Firebase 10.7.0 should unblock you until we are able to find a solution.

TuncayEnsi commented 1 year ago

Hey Nick (@ncooke3 ) I very much appreciate the work you guys are doing here. Fixing this so fast, also the fast pace at which you respond to the issues and offer solutions! Keep up the good work!

I can not give an exact reproduction method sadly because we are working on a huge project with dozen of classes and tens of thousands of lines of code.

But I think the issue does not have to do with the concrete implementation, I can explain the exact circumstances it accord to me:

I had a completely functioning application implementing more firebase services than not. Everything from Storage to auth till Crashlytics, in the latest Xcode 14 version and not having updated firebase since mid 2022 (I was on firebase 9.(6?).0)). I downloaded the Xcode 15 Beta on Mac OS Ventura. There were so much compiler problems that it did not even make sense. Therefore I updated Firebase by just telling Xcode to update to the latest package version. This worked but produced the gRPC signing error. You guys having solved that, I updated again and was on what I think was gRPC 1.50.2. Then the Segmentation fault was thrown when deploying to a physical Device the problem did not occur in the Preview or the Simulator for me. Trying to patch the Xcode side of things meaning: Derived Data clean, Build Folder Clean, Package Cache clean and multiple times of resolving the package versions did not help. I tried the Xcode side of things a lot, exactly this scheme, until I downgraded to Firebase 10.7.0 and everything worked, apart from Xcode telling me that there were duplicate Librarys showing 62 Warnings.

I hope this helps you guys a bit.

Sincerly

TuncayEnsi commented 1 year ago

I Can not provide you with log information because the project would not compile and would just tell me the same as in the open title of this thread.

TuncayEnsi commented 1 year ago

I was deploying to iOS 17 and can not tell you something about deploying to iOS 16

ncooke3 commented 1 year ago

I have researched some possible causes and have a few other requests that should help scope down the problem.

  1. Verify that only one firebase-ios-sdk copy is in your $(PROJECT_NAME).xcodeproj file. To check this, I ran:

    git grep -F 'XCRemoteSwiftPackageReference "firebase-ios-sdk" */ = {' -- PATH/TO/$(PROJECT_NAME).xcodeproj/

    This should find one reference within the project. This would rule out any weird Xcode related issue with the project format. My train of thought here would be that another Firebase package instance could cause a linking issue. Unlikely maybe, but worth checking.

  2. Try reproducing the issue in a project that is working for me. This experiment could help confirm whether or not the issue is in part related to project configuration in your project. To do this:

    • Clone the Firebase Quickstart repo.
      • Via SSH
        git clone git@github.com:firebase/quickstart-ios.git
      • Via HTTPS
        git clone https://github.com/firebase/quickstart-ios.git
    • Check out firestore-spm branch on the repo:
      cd quickstart-ios; git checkout firestore-spm
    • Ensure you are using Xcode 15's developer tools by verifying via:
      xcode-select --print-path 

      The above should output a path pointing to your Xcode 15 install. Of course, if the output is not expected, switch via:

      sudo xcode-select -s PATH/TO/YOUR/XCODE_15.app
    • Open the Xcode project with:
      xed firestore/FirestoreExample.xcodeproj
    • Wait for Xcode to open and load all dependencies. You should see Firebase version 10.10.0 in the Package Dependencies area in the project navigator on the left hand side of the window.
    • Add a dummy GoogleService-Info.plist. One is included in the repo clone, you just need to add it via:
      • File → Add files to "FirestoreExample"..., then, in the opened Finder window, select and add the GoogleService-Info.plist located in the firestore/ directory of the quickstart repo clone.
      • Last step – build and run the FirestoreExample scheme on a physical device. (You may need to sign to deploy to a physical.)

    Let me know if you have questions following these steps. If the app deploys successfully, then it may indicate there is a project configuration issue within your project that is, in combined with Firebase 10.8.0+, causing a problem.

    I'd like to know if:

    1. The app builds and deploys successfully.
    2. If the app doesn't deploy successfully, could you try changing the Firebase version to 10.7.0 in Xcode and trying again? The expectation is that this should work.
  3. I know I have asked before, but if a minimum reproducible example project can be created that reproduces the problem– that'd be very helpful. This could be as simple as a blank Xcode 15 project with a dependency on Firestore 10.8.0+. I have not been able to create one that reproduces the problem.

Thank you in advance for helping us narrow this down.

google-oss-bot commented 1 year ago

Hey @ncooke3. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

ncooke3 commented 1 year ago

Hi @TuncayEnsi and @JamieShaneRainbird, please let me know if you are still affected by this issue. I recommend trying Xcode 15 Beta 2 to see if the issue is still reproducible. And if it is, trying the steps in my previous post. Thanks!

ncooke3 commented 1 year ago

I'm closing this is it should be fixable by adding -ld64 to your project's Other Linker Flags build setting. Apple has acknowledged the issue ([comment](Xcode 15 linking error - https://developer.apple.com/forums/thread/731089?answerId=756074022#756074022)) and it sounds like it the crashing behavior should be fixed.