Skip to content

[Bug] "Undefined symbols:" on Xcode build #916

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
ChurikiTenna opened this issue Dec 27, 2023 · 28 comments
Closed

[Bug] "Undefined symbols:" on Xcode build #916

ChurikiTenna opened this issue Dec 27, 2023 · 28 comments

Comments

@ChurikiTenna
Copy link

ChurikiTenna commented Dec 27, 2023

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2022.3.16f1
  • Firebase Unity SDK version: 11.6.0
  • Source you installed the SDK: . unitypackage
  • Problematic Firebase Component: FirebaseAnalytics
  • Other Firebase Components in use: Auth,Firestore,AppCheck
  • Additional SDKs you are using:
    pod install result:
Installing AppAuth (1.6.2)
Installing BoringSSL-GRPC (0.0.24)
Installing Firebase (10.15.0)
Installing FirebaseABTesting (10.19.0)
Installing FirebaseAnalytics (10.15.0)
Installing FirebaseAppCheckInterop (10.19.0)
Installing FirebaseAuth (10.15.0)
Installing FirebaseCore (10.15.0)
Installing FirebaseCoreExtension (10.19.0)
Installing FirebaseCoreInternal (10.19.0)
Installing FirebaseFirestore (10.15.0)
Installing FirebaseInstallations (10.19.0)
Installing FirebasePerformance (10.15.0)
Installing FirebaseRemoteConfig (10.19.0)
Installing FirebaseSessions (10.19.0)
Installing FirebaseSharedSwift (10.19.0)
Installing GTMAppAuth (2.0.0)
Installing GTMSessionFetcher (3.2.0)
Installing GoogleAppMeasurement (10.15.0)
Installing GoogleDataTransport (9.3.0)
Installing GoogleSignIn (7.0.0)
Installing GoogleUtilities (7.12.0)
Installing PromisesObjC (2.3.1)
Installing PromisesSwift (2.3.1)
Installing RecaptchaInterop (100.0.0)
Installing abseil (1.20220623.0)
Installing gRPC-C++ (1.50.1)
Installing gRPC-Core (1.50.1)
Installing leveldb-library (1.22.2)
Installing nanopb (2.30909.1)
  • Platform you are using the Unity editor on: M1 Mac
  • Platform you are targeting: iOS
  • Scripting Runtime: IL2CPP
  • Pre-built SDK from the website or open-source from this repo: _____

[REQUIRED] Please describe the issue here:

I successfully built Xcode from Build Settings window.
When I try to run the app from Xcode, it fails with error.

Undefined symbols:
Linker command failed with exit code 1 (use -v to see invocation)

Weird thing is, usually there will be continuing comments after undefined symbols: , but it's empty, so there is no way to know what is the actual undefined symbols.

I tried
cleaning the build folder,
deleting ModuleCache,
pod deintegrate,
deleting Podfile.lock, Pods folder,
pod repo update,
building from the Build Settings again.
None of these worked.

Steps to reproduce:

  • Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)?
    No. but I intend to try later.

  • What's the issue repro rate? (eg 100%, 1/5 etc)
    100%

  • What happened? How can we make the problem occur?
    This is the log:

スクリーンショット 2023-12-27 13 20 59

I'm willing to share the minimum reproducible project.

@paulinon
Copy link
Contributor

Hi @ChurikiTenna,

Are you using Xcode 15? Could you try if adding -ld_classic to your other linker flags made any difference?

@paulinon paulinon added the needs-info Need information for the developer label Dec 27, 2023
@ChurikiTenna
Copy link
Author

Thank you for your reply @paulinon .

Yes. I am using Xcode 15.
However, adding -ld_classic did not make any difference..

スクリーンショット 2023-12-27 23 23 03

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels Dec 27, 2023
@ChurikiTenna
Copy link
Author

I found detailed error message.

ld: Undefined symbols:
_OBJC_CLASS_$_FIRMessaging, referenced from:
       in libFirebaseCppMessaging.a[arm64][4](messaging.mm.o)
  _OBJC_CLASS_$_FIRStorage, referenced from:
       in libFirebaseCppStorage.a[arm64][12](storage_ios.mm.o)
  _OBJC_CLASS_$_FIRStorageMetadata, referenced from:
       in libFirebaseCppStorage.a[arm64][11](metadata_ios.mm.o)
...
スクリーンショット 2023-12-28 12 03 20

@ChurikiTenna
Copy link
Author

ChurikiTenna commented Jan 9, 2024

Hi @paulinon .
Do you have any clue? Is it not related to the plugin?

Adding -ld_classic to the Other Linker Flags in Pods -> PROJECT -> Pods did not make any difference.

Adding to PROJECT -> Unity-iPhone showed different errors.

スクリーンショット 2024-01-10 17 45 12

@igloo12
Copy link

igloo12 commented Jan 17, 2024

I am getting this exact same error and the same thing happened when I added the -Ld_classic flag

@igloo12
Copy link

igloo12 commented Jan 17, 2024

@ChurikiTenna I have been unable to get any version of Firebase past 9.6 to work. I reverted back, and it worked. You might want to try 9.6

@georgemarkosian
Copy link

georgemarkosian commented Mar 21, 2024

Same here. Tried on Unity 2022.3.20 and 2022.3.22, Firebase 11.6.0 and 11.8.0. FacebookUnitySDK and AppsFlyer SDKs are in the project as well. Classic linker doesn't help. Was compiling without any issue last week.

I was able to get more details using the classic linked though:
Undefined symbol: absl::lts_20220623::variant_internal::ThrowBadVariantAccess()
Undefined symbol: absl::lts_20220623::optional_internal::throw_bad_optional_access()

@providence94
Copy link

providence94 commented Mar 22, 2024

same here!

Undefined symbol: absl::lts_20220623::variant_internal::ThrowBadVariantAccess()
Undefined symbol: absl::lts_20220623::optional_internal::throw_bad_optional_access()

these same things!

Due to some Xcode errors I understood that I had to update to 11.8 version
on 20th March around 12PM IST I updated and built the project successfully and pushed a build to textflight
but by 1PM IST the same build stopped working and started throwing this absl errors

and our older working commits has stopped building on Xcode all throwing the same errors :/

@providence94
Copy link

additionally
the below screenshot shows the error we faced that forced us to update the version to 11.8

Screenshot 2024-03-22 at 9 06 19 PM

and the one below is the error that's thrown by the latest 11.8 version
Screenshot 2024-03-20 at 21 13 24

@providence94
Copy link

from my understanding the problem specifically comes from Firestore
Since after commenting out all our firestore related code in the project(with the library still in the unity project) we tried building the Xcode project and it successfully compiled!

but the moment I use the Firestore namespace anywhere in code
the project fails to compile in Xcode

@georgemarkosian
Copy link

georgemarkosian commented Mar 22, 2024

After some back and forth we figured out the only 2 ways to make our app compile:

  1. Leave 11.6.0 and remove the Cloud Storage component from the project
  2. Update to 11.8.0 and remove Firestore

None of those are livable as our app relies on both. While discovering it we tried different versions of xCode (15.0.1, 15.1, 15.2, 15.3) and Unity (2022.3.20, 2022.3.22). We also tried removing other plugins with native components (FacebookSDK, AppsFlyer, GoogleSignIn) - no difference. We also tested another app we have that works without Firebase, it's ok.

We believe the issue lies in Firebase and hope it will be resolved soon. It affects our business as we can't produce builds and test the upcoming app update.

Update 1: tried updating cocoaPods version to 10.23 => results in Undefined symbols errors.

@hsallander
Copy link

hsallander commented Mar 25, 2024

We're also having the same issue. Using Unity 2021.3.36, Xcode 15.2, macOS Ventura on an M1 Max. Firebase Unity SDK version 11.8.0 (have tried 11.6.0 as well but with the same results).

Firebase installed using the Package Manager (tgz-files), using the following packages:

  • com.google.firebase.analytics
  • com.google.firebase.app
  • com.google.firebase.auth
  • com.google.firebase.crashlytics
  • com.google.firebase.firestore
  • com.google.firebase.functions
  • com.google.firebase.remote-config
  • com.google.firebase.storage

Side note: Firebase 11.6.0 did work for us when we where on Unity 2021.3.21, but after upgrading to 2021.3.36 we get this error and are unable to build for iOS.

@providence94
Copy link

@hsallander
@georgemarkosian

I have made a separate Bug report for our woes because I understand that this particular bug ticket was opened 3 months ago on a slightly different error scenario (it maybe linked or it may not be idk)
lets all have a cry there

#974

@ChurikiTenna
Copy link
Author

Sorry for being absent.
I ended up fixing the error by creating a new folder, and did the build for iOS in that folder.

Couldn't find what exactly was causing the error, but I guess some kind of caches were doing weird stuff.

@providence94
Copy link

@ChurikiTenna thanks for getting back.
Ive seen it in multiple support pages that you should match all the versions of the firebase components you are using otherwise you will end up with some weird errors.

@hsallander
Copy link

hsallander commented Mar 25, 2024

Sorry for being absent. I ended up fixing the error by creating a new folder, and did the build for iOS in that folder.

Couldn't find what exactly was causing the error, but I guess some kind of caches were doing weird stuff.

Thanks for the update. How do you mean creating a new folder fixed the issue? I've tried clearing the cocoapods cache and reintegrating the pods but still get the same error. Or do you mean reimporting all the way down to Unity, like deleting the Library and reimporting before doing the build?

@shniqq
Copy link

shniqq commented Mar 25, 2024

FYI: Faced the same or similar issue, found a fix for our case, see #975 (didnt see this post when starting to write that one)

@ramibadran
Copy link

Hi

We are facing the same issue as below:

We received an email from Apple requesting builds using the iOS 17 SDK or later (due date mid-April), so we proceeded accordingly. However, after upgrading to MacOS Sonoma 14.4 and Xcode 15.3, we encountered several crashes on devices running iOS 17.3 and 17.4.

To address this issue, we upgraded to Firebase SDK version 11.8.0, previously we were using version 11.6.0. Initially, this resolved the issue, and we were able to successfully build for a couple of days.

However, today, when attempting to create another build, we encountered the attached errors and are unable to proceed further with the build process. We attempted to downgrade to version 11.7.0, but encountered the same error with that version as well.

Would you please give advice or help in getting out of this? it impact our business.

Screenshot 2024-03-27 at 1 42 25 AM

@a-maurice
Copy link
Collaborator

Hey all, we haven't been able to reliably reproduce this on our end, which is why it has taken a bit of time to find a solution or workaround.

For people that do have this problem, can you include your Podfile.lock? Our best guess is that it is somehow getting a version of absl that is incompatible with the library.
Another thing that people can try is manually running pod repo update to see if that helps potentially pull in correct pods (assuming that is where the problem lies).

@hsallander
Copy link

Hey all, we haven't been able to reliably reproduce this on our end, which is why it has taken a bit of time to find a solution or workaround.

For people that do have this problem, can you include your Podfile.lock? Our best guess is that it is somehow getting a version of absl that is incompatible with the library. Another thing that people can try is manually running pod repo update to see if that helps potentially pull in correct pods (assuming that is where the problem lies).

Thanks for the update @a-maurice . Here's my Podfile.lock file (changed file extension to .txt in order to be able to upload it)
Podfile.lock.txt

@aryansaurav
Copy link

Hello all,

We are facing the same issue. Updated all the .tgz files to 11.8.1 and then 11.9.0. To no help so far.

I see this issue is still open though the thread has been so long.

Is there any tested way to solve it? Any steps we could try?

@providence94
Copy link

@aryansaurav do a pod install verbose and have a look at the versions of all the firebase modules being installed.
also be mindful about other sdks you have installed. undefined symbols can come from anywhere.
if using FacebookSDK disable Link Frameworks Statically to false.

@aryansaurav
Copy link

@providence94 Thanks for your response. The issue is not coming from Facebook SDK.

The Firebase modules in pod install verbose log are different, some 10.22.0 some 10.24.0.. Do I need to enforce all of them to have the same version? Some, for example, FirestoreInternal are not in the Podfile by default. They install 10.24.0 by default.

I wonder if someone has already tried enforcing same version for all firebase modules and succeeded that way. And which version worked for them? 10.24.0 or 10.22.0 or something else

@providence94
Copy link

providence94 commented Apr 29, 2024 via email

@aryansaurav
Copy link

aryansaurav commented Apr 29, 2024 via email

@providence94
Copy link

providence94 commented Apr 29, 2024 via email

@a-maurice
Copy link
Collaborator

Sorry this should have been closed with either 11.7.1 (which built against the new internal Pods) or 11.8.0, which is built against the current latest.

If you are still having a problem, it would be better to open a new issue, and include everything, especially the full error logs, and the Podfile.lock file.

@aryansaurav
Copy link

aryansaurav commented Apr 30, 2024 via email

@firebase firebase locked and limited conversation to collaborators May 30, 2024
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