Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Undefined symbols for architecture x86_64

Tags:

ios

firebase

I am using firebase as part of a project I am working on in iOS, and I just stumbled upon the following linking error when I try to compile my code against an iPhone 6 or 7 simulator for testing.

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GTMSessionUploadFetcher", referenced from:
      objc-class-ref in FirebaseStorage(FIRStorageUploadTask_d5061b1e2b5f1bb249816cc5fc42ff62.o)
  "_OBJC_CLASS_$_GTMLogger", referenced from:
      objc-class-ref in FirebaseMessaging(GIPReachability_ae5504e4a6a28a1d8997c6f38e8bff8b.o)
  "_kGTMSessionUploadFetcherStandardChunkSize", referenced from:
      -[FIRStorageUploadTask enqueue] in FirebaseStorage(FIRStorageUploadTask_d5061b1e2b5f1bb249816cc5fc42ff62.o)
  "_GTMFetcherStandardUserAgentString", referenced from:
      -[FIRAuthBackendRPCIssuerImplementation init] in FirebaseAuth(FIRAuthBackend_ea73237c278bd1b78e1c76db2a16775a.o)
  "_OBJC_CLASS_$_GTMSessionFetcher", referenced from:
      objc-class-ref in FirebaseStorage(FIRStorageDownloadTask_c390366e83519f6636ca985ecb70e5d0.o)
      objc-class-ref in FirebaseStorage(FIRStorage_691ea9ac7cb4d224d37df2ff8a911989.o)
  "_OBJC_CLASS_$_GTMSessionFetcherService", referenced from:
      objc-class-ref in FirebaseAuth(FIRAuthBackend_ea73237c278bd1b78e1c76db2a16775a.o)
      objc-class-ref in FirebaseStorage(FIRStorage_691ea9ac7cb4d224d37df2ff8a911989.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using Xcode 8.2.1, swift 3.0, and I also have the following Pod file in my project

pod 'Braintree'
pod 'Firebase/Auth'
pod 'Firebase/Database'
pod 'Firebase/Core'
pod 'Firebase/Storage'
pod 'Firebase/Messaging'
pod 'Firebase/RemoteConfig'
pod 'GeoFire', :git=>'https://github.com/firebase/geofire-objc.git'
pod 'ObjectMapper', '~> 2.2'

I have done a pod update in case something was out of date, but no luck. The code compiles and runs fine when I use an iPhone 4 or 5 simulator.

Edit:

I have set Build Active architectures to No, in valid architectures I have listed arm64, armv7, armv7s and now Objectmapper is failing even though import ObjectMapper is declared in the file

 Use of undeclared type 'Mappable'

Any help would be greatly appreciated! Thank you in advance.

George.

like image 992
gdev Avatar asked Feb 17 '17 07:02

gdev


5 Answers

Just discovered a similar problem and got it solved by clearing Pod-Cache.

Clear CocoaPods Cache

pod deintegrate && pod cache clean --all

Re-Install Pods

pod install

like image 54
coyer Avatar answered Nov 12 '22 21:11

coyer


For me I just installed Firebase framework to Xcode, not using CocoaPods due to other unsolvable issues. After build there is similar errors like above with "symbol(s) not found for architecture x86_64". (maybe because I am working with Xcode on VMWare)

Then I have to manually go to General - Linked Frameworks and Libraries and add:

libsqlite3.tbd, libz.tbd, libc++.tbd

for the project to work.

like image 22
Quan Nguyen Avatar answered Nov 12 '22 20:11

Quan Nguyen


Also had this problem after installing pods for Firebase, using CocoaPods as explained in the Firebase site:

https://firebase.google.com/docs/ios/setup?hl=es-419#prerequisites

pod 'Firebase/Analytics' pod 'Firebase/Auth'

During the installation of the pods I received a warning telling that:

[!] The target `myTarget [Debug]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

[!] The target `myTarget [Release]` overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig'.
    - Use the `$(inherited)` flag, or
    - Remove the build settings from the target.

When I compiled I got the error for several files:

Undefined symbols for architecture x86_64:

I tried the solution of the following answer before the one in this answer, and it worked as a charm:

The target ... overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Pods.xcconfig

Basically the solution was (as explained by @Ankish Jain):

Go to your Target Build Settings -> Other linker flags -> double click -> + button. Add $(inherited) to a new line.

After that I compiled succesfully, and new flag where added automatically to the Build Settings.

like image 12
L33MUR Avatar answered Nov 12 '22 20:11

L33MUR


It seems to be a glitch with derived data. I quitted out of Xcode, I removed all Derived Data in /Users/USER_NAME/Library/Developer/Xcode/PROJECT_NAME

Restarted Xcode, compiled and all works as expected, no need to change anything in Active Architecture Only or anything.

like image 11
gdev Avatar answered Nov 12 '22 21:11

gdev


I tried the "clearing Cocoapods cache" and the "removing derived data" solutions but that didn't work. What worked for me was a step I found in the Carthage setup (I'm still using Cocoapods)

Add $(OTHER_LDFLAGS) -ObjC flag to "Other Linker Flags" in "Build Settings".

You can see the step here: https://github.com/firebase/firebase-ios-sdk/blob/master/Carthage.md

My Info

Installation: Cocoapods | SDK: FirebaseAnalytics (6.1.2) | IDE: Xcode 11.0 | macOS: Mojave 10.14.5 Beta | Language: Swift 4.2 | Platform Target: iOS 11.0+

like image 11
Kilo Loco Avatar answered Nov 12 '22 21:11

Kilo Loco