firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
201 stars 34 forks source link

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

Closed ChurikiTenna closed 2 months ago

ChurikiTenna commented 6 months ago

[REQUIRED] Please fill in the following fields:

[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:

I'm willing to share the minimum reproducible project.

paulinon commented 6 months ago

Hi @ChurikiTenna,

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

ChurikiTenna commented 6 months ago

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
ChurikiTenna commented 6 months ago

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 commented 6 months ago

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 commented 6 months ago

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

igloo12 commented 6 months ago

@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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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:

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 commented 3 months ago

@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

https://github.com/firebase/firebase-unity-sdk/issues/974

ChurikiTenna commented 3 months ago

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 commented 3 months ago

@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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 2 months ago

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 commented 2 months ago

@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 commented 2 months ago

@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 commented 2 months ago

if you fetch the latest version of firebase sdk this issue should be resolved. if you for some reason have to stick to this version have a look at the relevant scripts posted somewhere here which forces the same version to all dependencies. this issue was in firebase 11.8. i had opened a ticket regarding this and got it resolved

On Mon, 29 Apr 2024 at 9:47 PM, aryansaurav @.***> wrote:

@providence94 https://github.com/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

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083148232, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNAVITPIOGUP3ZEIY5FE7LY7ZXAPAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE2DQMRTGI . You are receiving this because you were mentioned.Message ID: @.***>

aryansaurav commented 2 months ago

Thanks again. I tried with the latest release 11.9. Did the fresh build, cleaned the library folder too. Nothing seems to help though

Just a month ago it worked with an older version of firebase 11.7 and unity

Wondered if you can share your unity version and x code version, other system configuration?

On Mon, Apr 29, 2024, 18:26 Ashwin Shanker G @.***> wrote:

if you fetch the latest version of firebase sdk this issue should be resolved. if you for some reason have to stick to this version have a look at the relevant scripts posted somewhere here. i had opened a ticket regarding this and got it resolved

Best Regards, Ashwin Shanker G :)

On Mon, 29 Apr 2024 at 9:47 PM, aryansaurav @.***> wrote:

@providence94 https://github.com/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

— Reply to this email directly, view it on GitHub < https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083148232>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACNAVITPIOGUP3ZEIY5FE7LY7ZXAPAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE2DQMRTGI>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083166194, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVC2DF2VFIXZOBGBBDX5MLY7ZYCFAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE3DMMJZGQ . You are receiving this because you were mentioned.Message ID: @.***>

providence94 commented 2 months ago

then use the scripts to force the version number. even on 11.9 your pod versions are different? then something’s definitely wrong.

check this whole thread https://github.com/firebase/firebase-unity-sdk/issues/974

On Tue, 30 Apr 2024 at 2:00 AM, aryansaurav @.***> wrote:

Thanks again. I tried with the latest release 11.9. Did the fresh build, cleaned the library folder too. Nothing seems to help though

Just a month ago it worked with an older version of firebase 11.7 and unity

Wondered if you can share your unity version and x code version, other system configuration?

On Mon, Apr 29, 2024, 18:26 Ashwin Shanker G @.***> wrote:

if you fetch the latest version of firebase sdk this issue should be resolved. if you for some reason have to stick to this version have a look at the relevant scripts posted somewhere here. i had opened a ticket regarding this and got it resolved

Best Regards, Ashwin Shanker G :)

On Mon, 29 Apr 2024 at 9:47 PM, aryansaurav @.***> wrote:

@providence94 https://github.com/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

— Reply to this email directly, view it on GitHub <

https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083148232>,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ACNAVITPIOGUP3ZEIY5FE7LY7ZXAPAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE2DQMRTGI>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083166194>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/AKVC2DF2VFIXZOBGBBDX5MLY7ZYCFAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE3DMMJZGQ>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083608619, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACNAVIRPRHEH77OO6LRVVULY72UW5AVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGYYDQNRRHE . You are receiving this because you were mentioned.Message ID: @.***>

a-maurice commented 2 months ago

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 commented 2 months ago

With the 11.9, the versions are same in the Podfile. Still that does not fix the undefined symbol error

I'm suspecting if that fixed the issue for you, it's mostly due to the unity version and x code version you're using

On Mon, Apr 29, 2024, 22:34 Ashwin Shanker G @.***> wrote:

then use the scripts to force the version number. even on 11.9 your pod versions are different? then something’s definitely wrong.

check this whole thread https://github.com/firebase/firebase-unity-sdk/issues/974

On Tue, 30 Apr 2024 at 2:00 AM, aryansaurav @.***> wrote:

Thanks again. I tried with the latest release 11.9. Did the fresh build, cleaned the library folder too. Nothing seems to help though

Just a month ago it worked with an older version of firebase 11.7 and unity

Wondered if you can share your unity version and x code version, other system configuration?

On Mon, Apr 29, 2024, 18:26 Ashwin Shanker G @.***> wrote:

if you fetch the latest version of firebase sdk this issue should be resolved. if you for some reason have to stick to this version have a look at the relevant scripts posted somewhere here. i had opened a ticket regarding this and got it resolved

Best Regards, Ashwin Shanker G :)

On Mon, 29 Apr 2024 at 9:47 PM, aryansaurav @.***> wrote:

@providence94 https://github.com/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

— Reply to this email directly, view it on GitHub <

https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083148232>,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/ACNAVITPIOGUP3ZEIY5FE7LY7ZXAPAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE2DQMRTGI>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub <

https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083166194>,

or unsubscribe <

https://github.com/notifications/unsubscribe-auth/AKVC2DF2VFIXZOBGBBDX5MLY7ZYCFAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGE3DMMJZGQ>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub < https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083608619>,

or unsubscribe < https://github.com/notifications/unsubscribe-auth/ACNAVIRPRHEH77OO6LRVVULY72UW5AVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGYYDQNRRHE>

. You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-unity-sdk/issues/916#issuecomment-2083615128, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKVC2DD67URLNHP3CNIZAX3Y72VGJAVCNFSM6AAAAABBD5DQIOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBTGYYTKMJSHA . You are receiving this because you were mentioned.Message ID: @.***>