Ian Barber Ian Barber - 1 month ago 47
iOS Question

Undefined symbols with debug builds in Firebase/CrashReporting

Since updating to Firebase Crash Reporting 3.8.0 via Cocoapods, I see the following error during builds for Debug mode. I am able to build in Release mode without error.

Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_GTMLogNoFilter", referenced from:
objc-class-ref in FirebaseCrash(FCRSystemLogger_6532fb37dc095ffa73463b57baf5fca7.o)
"_OBJC_CLASS_$_GTMLogBasicFormatter", referenced from:
objc-class-ref in FirebaseCrash(FCRSystemLogger_6532fb37dc095ffa73463b57baf5fca7.o)
"_OBJC_CLASS_$_GTMLogger", referenced from:
objc-class-ref in FirebaseCrash(FCRSystemLogger_6532fb37dc095ffa73463b57baf5fca7.o)
objc-class-ref in FirebaseCrash(uploader_089041b840f448492d858d7daf481e47.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Answer

This occurs when the XCode setting Build Active Architecture Only is set to NO in debug mode.

Several of the Firebase SDKs rely on pods built from source. By default, CocoaPods sets the Build Active Architecture Only to YES for all Pods built from source when running in Debug. This mismatch causes the missing symbols you mentioned.

There are two options to fix the issue:

  1. Switch Build Active Architecture Only to YES in debug on your main project.
  2. Set you pods' Build Active Architecture Only to NO while in debug (taken from this post):

    post_install do |installer_representation|
      installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
          config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        end
      end
    end