firebase / firebase-ios-sdk

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

Apple Mach-O Linker Error Group Duplicate symbol [No Pod] #674

Closed tuxtux59 closed 6 years ago

tuxtux59 commented 6 years ago

Environment

The problem

Hi, I'm trying to integrate Firebase Auth(for Facebook connect) but I had an old setup for FirebaseAnalytics. My problem is that the app cannot be built due to Apple Mach-O Linker Error Group `ld: 88 duplicate symbols for architecture x86_64 clang: error: linker command failed with exit code 1``

And many duplicate symbol occurrences between FirebaseAnalytics & FirebaseCore (such as _OBJC_CLASS_$_FIRAnalyticsConfigurationor _OBJC_METACLASS_$_FIRApp)

Is there a known conflict between these two Framework? If it is which one to delete?

Steps I followed to achieve at this point:

/!\ I'm not using CocoaPod but classic Framework setup

For more information Firebase frameworks are present in 'Linked Framework & Librairies' and in Build Phases-> Link Binary with Libraries

Thanks a lot in advance!

paulb777 commented 6 years ago

It looks like you have incompatible versions of FirebaseAnalytics and FirebaseCore. Please make sure you install those from the same zipfile. To make sure there is not extra cruft from an old installation, remove Xcode's DerivedData - rm -rf ~/Library/Developer/Xcode/DerivedData/

tuxtux59 commented 6 years ago

Thanks but seems to not work (still same error with duplicate symbols ) :(

paulb777 commented 6 years ago

Are you able to share a reproducible example by git or zip?

tuxtux59 commented 6 years ago

Unfortunately not because too much to extract or set private :/ . However, I can provide all the installed firebase packages as well as the complete trace of the error !?

paulb777 commented 6 years ago

In our testing, we validate that the FirebaseCore and FirebaseAnalytics are compatible, so the issue is likely related to something about your integration.

I suggest you try to build a sample app - perhaps one of the quickstart apps here. If the app works, compare the integration with your proprietary app. If it doesn't, share it with us for advice.

tuxtux59 commented 6 years ago

I've discarded my modifications to a previous working version (without the changes of this issue) and here are my framework installed:

Do I need to replace already installed frameworks by ones of Auth and Analytics Zip's folders?(such as FirebaseAnalytics, FirebaseInstanceID or FirebaseDynamicLinks[present in DynamicLinks Zip's folder) ?

paulb777 commented 6 years ago

All Firebase frameworks should come from the same zip download. The Google*Utilities frameworks are no longer Firebase dependencies, so based on the list, there are outdated installed frameworks.

tuxtux59 commented 6 years ago

Ok So does it means that these framework need to be removed? If so, to be sure: a simple right click and delete from navigation panel is ok?

morganchen12 commented 6 years ago

Make sure the frameworks aren't being linked in your target's Build Phases section as well.

tuxtux59 commented 6 years ago

In fact as soon as I drag & drop a Framework into my project's navigation panel it's automatically added to Build Phases -> Link Binary With Libraries section, do I need to delete them from this list?

Here is my full process:

The current working state : I use Firebase to use dynamic links (to open specific controller from outside app) & Analytics to log events. Here is the list of Firebase/google frameworks present in this working state:

First , I deleted all these frameworks by deletion from navigation panel

  1. I've deleted Google*Utilities packages and result of undefined symbols on GoogleSignIn & FirebaseDynamicLinks packages
  2. I've deleted GoogleSignIn & FirebaseDynamicLinks packages to try resolve previous error this results to undefined symbols from FirebaseAnalytics
  3. Deletion of FirebaseAnalytics resulting to error from all controllers where I import Firebase, at this point it only remain FirebaseInstanceID so I deleted It also, so no more firebase/google Frameworks 4.As Zip README file said: I drag & drop all Analytics frameworks to navigation pane using Copy if neededcheckbox :
  1. As I want to add Firebase Auth I drag & drop packages from this folder:

    • [ ] - FirebaseAuth
    • [ ] - GTMSessionFetcher
  2. GoogleSignIn & FirebaseDynamicLinks where previously present, so I decided to drag & drop frameworks from DynamicLinks & Invites folders:

  1. The Invites folder contains Resources folder so as README file said I drag & drop to my navigation pane
  2. I replace Firebase.h and module.modulemap files by ZIP files ones
  3. I checked if -ObjCwas present on Other Linker Flags (it was)
  4. At this point, following README steps I tried to build the project, unfortunately still errors around undefined symbols from FirebaseInvites, FirebaseAnalytics & FirebaseDynamicLinks (such as _GSDK_GTLServicePlus , _GSDK_GTMLogger or FirebaseDynamicLinks)
  5. Following @morganchen12 advice I removed all frameworks updated/added from Build Phases/Link Binary With Libraries list , this results with the following undefined symbols: Undefined symbols for architecture x86_64: "_OBJC_CLASS_$_FIRAnalytics", referenced from: objc-class-ref in UIViewController+.o "_OBJC_CLASS_$_FIRDynamicLink", referenced from: objc-class-ref in AppDelegate.o "_OBJC_CLASS_$_FIRDynamicLinks", referenced from: objc-class-ref in AppDelegate.o "_OBJC_CLASS_$_FIRApp", referenced from: objc-class-ref in AppDelegate.o

Last informations that I can say are :

Did I miss something somewhere?

paulb777 commented 6 years ago

The GSDK symbols indicate that you're still linking in Google components from an older zip file.

tuxtux59 commented 6 years ago

Here are all my dependencies of the project image

paulb777 commented 6 years ago

I don't see any problems with the list.

It looks like you removed too much in step 12. I believe @morganchen12 meant to verify the out-dated frameworks were removed - not all of them.

At Step 11, Check whatever component is generating the missing symbols to _GSDK_GTLServicePlus and _GSDK_GTMLogger and verify it's from the latest zip.

tuxtux59 commented 6 years ago

Here are my current (all steps) frameworks in build phases/Link Binary With Libraries list image

tuxtux59 commented 6 years ago

I tried to add all framework to build phases but many errors were thrown, I've deleted ones that produce the errors I am now with same errors as step 11 but with these build phases frameworks:

image

paulb777 commented 6 years ago

GoogleAppUtilities is a deprecated framework. What are the full error messages?

tuxtux59 commented 6 years ago

I've deleted GoogleAppUtilities but still this following error

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_FIRAnalytics", referenced from:
      objc-class-ref in UIViewController+.o
     (maybe you meant: _OBJC_CLASS_$_FIRAnalyticsConfiguration)
  "_OBJC_CLASS_$_FIRDynamicLink", referenced from:
      objc-class-ref in AppDelegate.o
  "_OBJC_CLASS_$_FIRDynamicLinks", referenced from:
      objc-class-ref in AppDelegate.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
paulb777 commented 6 years ago

FirebaseAnalytics.framework and FirebaseDynamicLinks.framework are missing from the last list you published.

tuxtux59 commented 6 years ago

I've added this frameworks to build phases and also found that some frameworks weren't from ZIP files so I replace thoses ones. After some hope due to new syntax error in fact I fall again in new errors linked to FirebaseAnalytics.

Here is the error: Undefined symbols for architecture x86_64: "_nano_encode_repeated_string", referenced from: _firapb_set_string_filter_encoders in FirebaseAnalytics(firapb_string_filter_encoder_31bdd30f08496dd0d5483f963cac4130.o) "_nano_encode_repeated_uint64", referenced from: _firapb_set_result_data_encoders in FirebaseAnalytics(firapb_result_data_encoder_1315d0d417ab70ba3339564ef3df374d.o) "_nano_encode_string", referenced from: _firapb_set_event_encoders in FirebaseAnalytics(firapb_event_encoder_236e7dc88adbabdf6bb4cc2b8003def2.o) _firapb_set_event_config_encoders in FirebaseAnalytics(firapb_event_config_encoder_5286349c3d14273afb2db6ff07ec9417.o) _firapb_set_event_filter_encoders in FirebaseAnalytics(firapb_event_filter_encoder_fbf960deab2cec6acb1a9874868edaf1.o) _firapb_set_event_param_encoders in FirebaseAnalytics(firapb_event_param_encoder_9ae5653ad74424c0d261abfdeb89ab4d.o) _firapb_set_filter_encoders in FirebaseAnalytics(firapb_filter_encoder_3e99a54ad2621dc60f0b55786f32ce9e.o) _firapb_set_measurement_bundle_encoders in FirebaseAnalytics(firapb_measurement_bundle_encoder_5c6504019b27e3d5345f887360fdca1f.o) _firapb_set_measurement_config_encoders in FirebaseAnalytics(firapb_measurement_config_encoder_0e9a1f2e9cc3e59de4a969232efb1b01.o) ... "_pb_encode_tag_for_field", referenced from: _firapb_encode_repeated_audience in FirebaseAnalytics(firapb_audience_encoder_60e69197f0256dacef92cbf53e8494e4.o) _firapb_encode_repeated_audience_leaf_filter_result in FirebaseAnalytics(firapb_audience_leaf_filter_result_encoder_bf10226fd1e201d1bdcfa1f35bbe671f.o) _firapb_encode_repeated_event in FirebaseAnalytics(firapb_event_encoder_236e7dc88adbabdf6bb4cc2b8003def2.o) _firapb_encode_repeated_event_config in FirebaseAnalytics(firapb_event_config_encoder_5286349c3d14273afb2db6ff07ec9417.o) _firapb_encode_repeated_event_filter in FirebaseAnalytics(firapb_event_filter_encoder_fbf960deab2cec6acb1a9874868edaf1.o) _firapb_encode_repeated_event_param in FirebaseAnalytics(firapb_event_param_encoder_9ae5653ad74424c0d261abfdeb89ab4d.o) _firapb_encode_repeated_filter in FirebaseAnalytics(firapb_filter_encoder_3e99a54ad2621dc60f0b55786f32ce9e.o) ... "_pb_encode_submessage", referenced from: _firapb_encode_repeated_audience in FirebaseAnalytics(firapb_audience_encoder_60e69197f0256dacef92cbf53e8494e4.o) _firapb_encode_repeated_audience_leaf_filter_result in FirebaseAnalytics(firapb_audience_leaf_filter_result_encoder_bf10226fd1e201d1bdcfa1f35bbe671f.o) _firapb_encode_repeated_event in FirebaseAnalytics(firapb_event_encoder_236e7dc88adbabdf6bb4cc2b8003def2.o) _firapb_encode_repeated_event_config in FirebaseAnalytics(firapb_event_config_encoder_5286349c3d14273afb2db6ff07ec9417.o) _firapb_encode_repeated_event_filter in FirebaseAnalytics(firapb_event_filter_encoder_fbf960deab2cec6acb1a9874868edaf1.o) _firapb_encode_repeated_event_param in FirebaseAnalytics(firapb_event_param_encoder_9ae5653ad74424c0d261abfdeb89ab4d.o) _firapb_encode_repeated_filter in FirebaseAnalytics(firapb_filter_encoder_3e99a54ad2621dc60f0b55786f32ce9e.o) ... "_nano_two_pass_encoding", referenced from: _firapb_encode_audience in FirebaseAnalytics(firapb_audience_encoder_60e69197f0256dacef92cbf53e8494e4.o) _firapb_encode_audience_leaf_filter_result in FirebaseAnalytics(firapb_audience_leaf_filter_result_encoder_bf10226fd1e201d1bdcfa1f35bbe671f.o) _firapb_encode_event in FirebaseAnalytics(firapb_event_encoder_236e7dc88adbabdf6bb4cc2b8003def2.o) _firapb_encode_event_config in FirebaseAnalytics(firapb_event_config_encoder_5286349c3d14273afb2db6ff07ec9417.o) _firapb_encode_event_filter in FirebaseAnalytics(firapb_event_filter_encoder_fbf960deab2cec6acb1a9874868edaf1.o) _firapb_encode_event_param in FirebaseAnalytics(firapb_event_param_encoder_9ae5653ad74424c0d261abfdeb89ab4d.o) _firapb_encode_filter in FirebaseAnalytics(firapb_filter_encoder_3e99a54ad2621dc60f0b55786f32ce9e.o) ... "_pb_read", referenced from: _firapb_decode_repeated_audience in FirebaseAnalytics(firapb_audience_decoder_a111e3104442b02d115dca1dddda6f64.o) _firapb_decode_repeated_audience_leaf_filter_result in FirebaseAnalytics(firapb_audience_leaf_filter_result_decoder_dc74182e4b8b28970f726fb970aff4c3.o) _firapb_decode_repeated_event in FirebaseAnalytics(firapb_event_decoder_eace5a2a22f95b8956e147be7127c44f.o) _firapb_decode_repeated_event_config in FirebaseAnalytics(firapb_event_config_decoder_b6d5f21125e8ef59b6d76ca40c1072ce.o) _firapb_decode_repeated_event_filter in FirebaseAnalytics(firapb_event_filter_decoder_9522f07fd4aa536594f59159e21b6fd4.o) _firapb_decode_repeated_event_param in FirebaseAnalytics(firapb_event_param_decoder_4ec5a87718ee5713314c2daba872e9bc.o) _firapb_decode_repeated_filter in FirebaseAnalytics(firapb_filter_decoder_7831016b6e2c42ba8d6aea3e039d3c45.o) ...

tuxtux59 commented 6 years ago

With a perfect guess reading this trace I decided to add Nano frameworks to build phases and app build successfully !

Thanks a lot @paulb777 , now it's a matter of integrating Facebook auth code :)

paulb777 commented 6 years ago

As you note in a comment above, ALL the frameworks in the Analytics folder must be added:

tuxtux59 commented 6 years ago

Ok ! I see that I haven't all these frameworks in the build phase that's maybe why app builds but crash on boot up ( e.g google.fira error)

Le mer. 17 janv. 2018 à 19:14, Paul Beusterien notifications@github.com a écrit :

As you note in a comment above, ALL the frameworks in the Analytics folder must be added:

  • FirebaseAnalytics
  • FirebaseCore
  • FirebaseCoreDiagnostics
  • FirebaseInstanceID
  • FirebaseNanoPB
  • GoogleToolboxForMac
  • nanopb

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/firebase/firebase-ios-sdk/issues/674#issuecomment-358393477, or mute the thread https://github.com/notifications/unsubscribe-auth/ACqNnwWfhmg36msRj4ex5jXE77dqQj8pks5tLjh3gaJpZM4Rf2eO .

morganchen12 commented 6 years ago

You'll have to post the crash message for us to help you further.

Closing this issue as it seems to not be a Firebase issue, but feel free to continue responding; we'll try to help you out.

tuxtux59 commented 6 years ago

Thanks for both of you! The app runs now! I don't know if I could reproduce this process perfectly but it seems to work ! I can now dig into Firebase Facebook Auth integration !