Skip to content
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

Undefined symbol: _OBJC_CLASS_$_GULAppEnvironmentUtil #8137

Closed
khoogheem opened this issue May 23, 2021 · 42 comments · Fixed by #8308
Closed

Undefined symbol: _OBJC_CLASS_$_GULAppEnvironmentUtil #8137

khoogheem opened this issue May 23, 2021 · 42 comments · Fixed by #8308

Comments

@khoogheem
Copy link

[REQUIRED] Step 1: Describe your environment

  • Xcode version: 12.2
  • Firebase SDK version: 8.9
  • Installation method: CocoaPods)
  • Firebase Component: Crashlytiics

[REQUIRED] Step 2: Describe the problem

Undefined symbol: OBJC_CLASS$_GULAppEnvironmentUtil

Steps to reproduce:

Build using 8.0.0

Screen Shot 2021-05-23 at 12 07 41 PM

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@rizafran
Copy link
Contributor

Thanks for reporting, @khoogheem. Can you share the detailed steps reproducing the issue? Also, a pod update may be required to ensure all recent dependencies are being pulled in. Thanks.

@khoogheem
Copy link
Author

Pod updated project all Firebase were set to 8.0.0
Clean project
Build project

@morganchen12
Copy link
Contributor

Can you share your Podfile.lock?

@morganchen12
Copy link
Contributor

Also, are you building with use_frameworks! and not using :linkage => :static?

@khoogheem
Copy link
Author

khoogheem commented May 25, 2021 via email

@khoogheem
Copy link
Author

this is what we add in:

def firebase
  # Add the pod for Firebase Crashlytics
  pod 'Firebase/Crashlytics'
  # add the Firebase pod for Google Analytics
  pod 'Firebase/Analytics'
  # Firebase Performance
  pod 'Firebase/Performance'
  # add pods for any other desired Firebase products
  # https://firebase.google.com/docs/ios/setup#available-pods
end

@morganchen12
Copy link
Contributor

Can you share the full build log output? It's likely this is occurring in a submodule of your app (i.e. one of your dependencies) and not the app itself.

@khoogheem
Copy link
Author

Ld /Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseCrashlytics/FirebaseCrashlytics.framework/FirebaseCrashlytics normal (in target 'FirebaseCrashlytics' from project 'Pods')
    cd /Users/xxx/Developer/xxx/ios-content-app/Pods
    /Applications/Xcode_12_2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -target x86_64-apple-ios13.0-simulator -dynamiclib -isysroot /Applications/Xcode_12_2.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.2.sdk -L/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseCrashlytics -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseCrashlytics -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseCore -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseCoreDiagnostics -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseInstallations -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/GoogleDataTransport -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/GoogleUtilities -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/PromisesObjC -F/Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/nanopb -filelist /Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FirebaseCrashlytics.build/Objects-normal/x86_64/FirebaseCrashlytics.LinkFileList -install_name @rpath/FirebaseCrashlytics.framework/FirebaseCrashlytics -Xlinker -rpath -Xlinker @executable_path/Frameworks -Xlinker -rpath -Xlinker @loader_path/Frameworks -dead_strip -Xlinker -object_path_lto -Xlinker /Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FirebaseCrashlytics.build/Objects-normal/x86_64/FirebaseCrashlytics_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -stdlib\=libc++ -fobjc-arc -fobjc-link-runtime -lc++ -lz -framework Security -framework SystemConfiguration -framework FBLPromises -framework FirebaseCore -framework FirebaseInstallations -framework Foundation -framework GoogleDataTransport -framework nanopb -framework Security -framework SystemConfiguration -compatibility_version 1 -current_version 1 -Xlinker -dependency_info -Xlinker /Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/FirebaseCrashlytics.build/Objects-normal/x86_64/FirebaseCrashlytics_dependency_info.dat -o /Users/xxx/Library/Developer/Xcode/DerivedData/project-esgmvpqlktgtvldltqmcjtupefnh/Build/Products/Debug-iphonesimulator/FirebaseCrashlytics/FirebaseCrashlytics.framework/FirebaseCrashlytics

Undefined symbols for architecture x86_64:
  "_OBJC_CLASS_$_GULAppEnvironmentUtil", referenced from:
      objc-class-ref in FIRCLSApplication.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

@khoogheem
Copy link
Author

if you want the lock file send me an email that I can sent it too.. vs posting here

@khoogheem
Copy link
Author

Ok.. if I use:

   pod 'Firebase'
  pod 'Firebase/Crashlytics'
  # add the Firebase pod for Google Analytics
  pod 'Firebase/Analytics'
  # Firebase Performance
  pod 'Firebase/Performance'

Then it works... which is odd as the only thing I see different between the two locks is core and analytics are swapped
and after I remove it it works as well.. so I am not sure what is going on...

@morganchen12
Copy link
Contributor

You should be able to fix this temporarily by going to your Pods.xcodeproj project and adding the GoogleUtilities framework to the FirebaseCrashlytics target's Link Binary with Libraries build phase.

A more permanent fix may need to come from CocoaPods or Firebase; some further investigation is required.

@morganchen12 morganchen12 self-assigned this May 25, 2021
@andreyoshev
Copy link

andreyoshev commented Jun 1, 2021

Same

  pod 'Firebase/AnalyticsWithoutAdIdSupport'
  pod 'Firebase/Crashlytics'
  pod 'Firebase/Messaging'

@fmalekpour
Copy link

Had the same issue, XCode -> Product -> Clean Build Folder fixed it.

@paulb777
Copy link
Member

paulb777 commented Jun 1, 2021

Marking as needs-info for a repro case from a clean build environment

@billdevoe
Copy link

For a more permanent workaround, you can add the dependency with the missing symbols directly to your target in your Podfile.

pod 'GoogleUtilities'

I added this but still have the crashlytics error (even after a clean and fresh build). If I remove Crashlytics, things compile properly. I did try the temporary fix you mentioned earlier about adding GoogleUtilities to the Link Binary with Libraries, but still saw the same error.

Overall, at this point I'm just excluding it.

@morganchen12
Copy link
Contributor

@paulb777 similar linker error in firebase/FirebaseUI-iOS#969.

@paulb777 paulb777 self-assigned this Jun 22, 2021
@paulb777
Copy link
Member

Thanks @morganchen12. I'll take a look in the next day or two

@paulb777
Copy link
Member

The FirebaseUI issue turns out to be a test infrastructure issue specific to FirebaseUI. See the firebase/FirebaseUI-iOS#969 for details.

So we're still looking for a reproducible example.

@mentalGrowthNick
Copy link

mentalGrowthNick commented Jun 24, 2021

Was able to remove the issue by updating my pod file from this:

pod 'Firebase/Core'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'

To this:

pod 'Firebase'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Performance'

Firebase/Performance installed GoogleUtilities, which might be the key.

After running pod install, I cleaned my build folder, then deleted derived data for the app.
After waiting for index to finish & then building the project, the issue went away for me.

@billdevoe
Copy link

Thanks for the note @mentalGrowthNick.

I do have Performance in my Podfile but I still get this issue even after doing all of the steps you mentioned. When I did the pod update I noticed that many of the pods I have updated to 8.2.0, but even with the new changes and everything, this problem persists.

As of today, I'm just not including Crashlytics at all and it's building. I would like to get it added but can't seem to get it working at the moment.

@morganchen12
Copy link
Contributor

@billdevoe can you share your project?

@billdevoe
Copy link

Hi @morganchen12 - I don't have anything simple that I could share at this point (this is a workspace/project for a published game). I will try to see if I can replicate the issue with a project that I could share.

@billdevoe
Copy link

billdevoe commented Jun 25, 2021

So I just created a new project, added the Pods (shown below) and then tried to build the workspace - same error.

This is about as basic as it gets.

Podfile (removed the commented lines as they hork the formatting):

platform :ios, '12.1'

pod 'Firebase'
pod 'Firebase/Crashlytics'
pod 'Firebase/Analytics'
pod 'Firebase/Performance'

pod 'Google-Mobile-Ads-SDK'

target 'Firebase Test App' do
use_frameworks!

end

Podfile.lock:

PODS:

  • Firebase (8.2.0):
    • Firebase/Core (= 8.2.0)
  • Firebase/Analytics (8.2.0):
    • Firebase/Core
  • Firebase/Core (8.2.0):
    • Firebase/CoreOnly
    • FirebaseAnalytics (~> 8.2.0)
  • Firebase/CoreOnly (8.2.0):
    • FirebaseCore (= 8.2.0)
  • Firebase/Crashlytics (8.2.0):
    • Firebase/CoreOnly
    • FirebaseCrashlytics (~> 8.2.0)
  • Firebase/Performance (8.2.0):
    • Firebase/CoreOnly
    • FirebasePerformance (~> 8.2.0)
  • FirebaseABTesting (8.2.0):
    • FirebaseCore (~> 8.0)
  • FirebaseAnalytics (8.2.0):
    • FirebaseAnalytics/AdIdSupport (= 8.2.0)
    • FirebaseCore (~> 8.0)
    • FirebaseInstallations (~> 8.0)
    • GoogleUtilities/AppDelegateSwizzler (~> 7.4)
    • GoogleUtilities/MethodSwizzler (~> 7.4)
    • GoogleUtilities/Network (~> 7.4)
    • "GoogleUtilities/NSData+zlib (~> 7.4)"
    • nanopb (~> 2.30908.0)
  • FirebaseAnalytics/AdIdSupport (8.2.0):
    • FirebaseCore (~> 8.0)
    • FirebaseInstallations (~> 8.0)
    • GoogleAppMeasurement (= 8.2.0)
    • GoogleUtilities/AppDelegateSwizzler (~> 7.4)
    • GoogleUtilities/MethodSwizzler (~> 7.4)
    • GoogleUtilities/Network (~> 7.4)
    • "GoogleUtilities/NSData+zlib (~> 7.4)"
    • nanopb (~> 2.30908.0)
  • FirebaseCore (8.2.0):
    • FirebaseCoreDiagnostics (~> 8.0)
    • GoogleUtilities/Environment (~> 7.4)
    • GoogleUtilities/Logger (~> 7.4)
  • FirebaseCoreDiagnostics (8.2.0):
    • GoogleDataTransport (~> 9.0)
    • GoogleUtilities/Environment (~> 7.4)
    • GoogleUtilities/Logger (~> 7.4)
    • nanopb (~> 2.30908.0)
  • FirebaseCrashlytics (8.2.0):
    • FirebaseCore (~> 8.0)
    • FirebaseInstallations (~> 8.0)
    • GoogleDataTransport (~> 9.0)
    • nanopb (~> 2.30908.0)
    • PromisesObjC (~> 1.2)
  • FirebaseInstallations (8.2.0):
    • FirebaseCore (~> 8.0)
    • GoogleUtilities/Environment (~> 7.4)
    • GoogleUtilities/UserDefaults (~> 7.4)
    • PromisesObjC (~> 1.2)
  • FirebasePerformance (8.2.0):
    • FirebaseCore (~> 8.0)
    • FirebaseInstallations (~> 8.0)
    • FirebaseRemoteConfig (~> 8.0)
    • GoogleDataTransport (~> 9.0)
    • GoogleUtilities/Environment (~> 7.4)
    • GoogleUtilities/ISASwizzler (~> 7.4)
    • GoogleUtilities/MethodSwizzler (~> 7.4)
    • Protobuf (~> 3.15)
  • FirebaseRemoteConfig (8.2.0):
    • FirebaseABTesting (~> 8.0)
    • FirebaseCore (~> 8.0)
    • FirebaseInstallations (~> 8.0)
    • GoogleUtilities/Environment (~> 7.4)
    • "GoogleUtilities/NSData+zlib (~> 7.4)"
  • Google-Mobile-Ads-SDK (8.7.0):
    • GoogleAppMeasurement (< 9.0, >= 7.0)
    • GoogleUserMessagingPlatform (>= 1.1)
  • GoogleAppMeasurement (8.2.0):
    • GoogleAppMeasurement/AdIdSupport (= 8.2.0)
    • GoogleUtilities/AppDelegateSwizzler (~> 7.4)
    • GoogleUtilities/MethodSwizzler (~> 7.4)
    • GoogleUtilities/Network (~> 7.4)
    • "GoogleUtilities/NSData+zlib (~> 7.4)"
    • nanopb (~> 2.30908.0)
  • GoogleAppMeasurement/AdIdSupport (8.2.0):
    • GoogleUtilities/AppDelegateSwizzler (~> 7.4)
    • GoogleUtilities/MethodSwizzler (~> 7.4)
    • GoogleUtilities/Network (~> 7.4)
    • "GoogleUtilities/NSData+zlib (~> 7.4)"
    • nanopb (~> 2.30908.0)
  • GoogleDataTransport (9.0.1):
    • GoogleUtilities/Environment (~> 7.2)
    • nanopb (~> 2.30908.0)
    • PromisesObjC (~> 1.2)
  • GoogleUserMessagingPlatform (2.0.0)
  • GoogleUtilities/AppDelegateSwizzler (7.4.3):
    • GoogleUtilities/Environment
    • GoogleUtilities/Logger
    • GoogleUtilities/Network
  • GoogleUtilities/Environment (7.4.3):
    • PromisesObjC (~> 1.2)
  • GoogleUtilities/ISASwizzler (7.4.3)
  • GoogleUtilities/Logger (7.4.3):
    • GoogleUtilities/Environment
  • GoogleUtilities/MethodSwizzler (7.4.3):
    • GoogleUtilities/Logger
  • GoogleUtilities/Network (7.4.3):
    • GoogleUtilities/Logger
    • "GoogleUtilities/NSData+zlib"
    • GoogleUtilities/Reachability
  • "GoogleUtilities/NSData+zlib (7.4.3)"
  • GoogleUtilities/Reachability (7.4.3):
    • GoogleUtilities/Logger
  • GoogleUtilities/UserDefaults (7.4.3):
    • GoogleUtilities/Logger
  • nanopb (2.30908.0):
    • nanopb/decode (= 2.30908.0)
    • nanopb/encode (= 2.30908.0)
  • nanopb/decode (2.30908.0)
  • nanopb/encode (2.30908.0)
  • PromisesObjC (1.2.12)
  • Protobuf (3.17.0)

DEPENDENCIES:

  • Firebase
  • Firebase/Analytics
  • Firebase/Crashlytics
  • Firebase/Performance
  • Google-Mobile-Ads-SDK

SPEC REPOS:
trunk:
- Firebase
- FirebaseABTesting
- FirebaseAnalytics
- FirebaseCore
- FirebaseCoreDiagnostics
- FirebaseCrashlytics
- FirebaseInstallations
- FirebasePerformance
- FirebaseRemoteConfig
- Google-Mobile-Ads-SDK
- GoogleAppMeasurement
- GoogleDataTransport
- GoogleUserMessagingPlatform
- GoogleUtilities
- nanopb
- PromisesObjC
- Protobuf

SPEC CHECKSUMS:
Firebase: 12c568897b807321964e89d2b263ef4c6cff3db6
FirebaseABTesting: 5f37131c5eceea579c471c915f7a0f8cad484d1f
FirebaseAnalytics: 7a744b1e7dc50125cb37714c6bdaea167e412082
FirebaseCore: 3a83f24c3de69ec9f9a426e2598125ea51f3a2ce
FirebaseCoreDiagnostics: 61384f54989065b15c36b5922b65112e86811d3c
FirebaseCrashlytics: 935dbdb043a286ca92a22d15e5780802403ea0ea
FirebaseInstallations: 9394ea09e242bf0816e95ac30e56a9214cc86ced
FirebasePerformance: fe501d202ae945c4a457fc49e9ad9785b51ba6f8
FirebaseRemoteConfig: 6695557b3dac704527c952502e799586941d399e
Google-Mobile-Ads-SDK: e242f463fdb8564ac3f11847a30215a0e042c934
GoogleAppMeasurement: b52eafc9dff542d580700e708216568bd2fbf168
GoogleDataTransport: 04c3e9a480bbcaa2ec3f5d27f1cdeb6a92f20c8d
GoogleUserMessagingPlatform: ab890ce5f6620f293a21b6bdd82e416a2c73aeca
GoogleUtilities: 45dbb24a7f351d69d0a601482b39ad6c32e30dab
nanopb: a0ba3315591a9ae0a16a309ee504766e90db0c96
PromisesObjC: 3113f7f76903778cf4a0586bd1ab89329a0b7b97
Protobuf: 7327d4444215b5f18e560a97f879ff5503c4581c

PODFILE CHECKSUM: dd633a8ad26610feb18e1908fb3d320393a2fdb3

COCOAPODS: 1.10.1

I'm wondering at this point if it's something about Objective-C or the target (iOS 12.1) or something else. I did have to do a LOT of updates to get gems working properly, but if I put the Crashlytics pod into the Podfile, I get the error.

@morganchen12
Copy link
Contributor

@billdevoe I tried reproducing this build failure with a very similar Podfile but was unable to do so (see the attached sample project). I'm using Xcode 12.3, though that shouldn't be a factor in this issue.

ReproExample.zip

@billdevoe
Copy link

Hi @morganchen12 - I built the example project you posted and it works (when I correctly remember to change the build target to the iOS version). So it's not completely FUBAR on my machine, just with most of the basic things I'm doing. I'll keep poking around to see what differences exist between the two things.

This is the project I made that doesn't build properly for me.

Firebase Test App.zip

@paulb777
Copy link
Member

Thanks for providing the example. The issue is clear now and fixed in #8308. The Crashlytics podspec was not defining one of its dependencies.

We do not typically see this issue because it is only exposed by an unusual Podfile. Putting use_frameworks! inside a target causes CocoaPods to generate both frameworks and library build targets and that exposes the build issue. There generally is not a reason to want to build all dependencies twice, so typically use_frameworks! is placed at the top of the Podfile.

@paulb777 paulb777 added this to the 8.3.0 - M99 milestone Jun 26, 2021
@billdevoe
Copy link

Thanks @paulb777 - I used someone's example of a Podfile to create mine. I guess I didn't realize it was in the target. BUT - moving it out of the target section of the Podfile DOES fix the issue.

Happy I was able to help you identify a bug and fix it. :D

Thanks for all the help, everyone. Very happy that things are working now. Much appreciated.

@abhideep
Copy link

So is the solution to move

use_frameworks!

out of the loop?

target 'Runner' do

@kumabook
Copy link

GoogleUtilities/Environment dependency doesn't exist in podspec of cocoapods repo.

https://github.com/CocoaPods/Specs/blob/master/Specs/e/7/d/FirebaseCrashlytics/8.3.0/FirebaseCrashlytics.podspec.json#L42

Is this as intended?
I think build errors still occurs.

@paulb777
Copy link
Member

Hmm, it looks like the fix missed 8.3.0. Sorry about that.

It is staged for 8.4.0 - https://github.com/firebase/SpecsStaging/blob/master/FirebaseCrashlytics/8.4.0/FirebaseCrashlytics.podspec.json

@bzdybowicz
Copy link

When will it be deployed to public specs ?

@paulb777
Copy link
Member

The 8.4.0 CocoaPods versions published today.

@firebase firebase locked and limited conversation to collaborators Jul 29, 2021
@paulb777
Copy link
Member

I just noticed this issue is still in our top ten search traffic.

If you're still seeing this with releases after 8.4.0, please open another issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.