firebase / quickstart-unity

Firebase Quickstart Samples for Unity
https://firebase.google.com/games
Apache License 2.0
822 stars 425 forks source link

Error building in XCode after upgrading to 6.2.0 #405

Closed TonyaGitHub closed 4 years ago

TonyaGitHub commented 5 years ago

Please fill in the following fields:

Unity editor version: 2018.4.3f1 Unity Scripting Runtime version: .NET 4.x Equivalent Unity Run in XCode: v10.1 Unity Run in XCode as: Debug Development Build: True Firebase Unity SDK version: 6.2.0 Firebase plugins in use (Auth, Database, etc.): Analytics, Auth, Database, Messaging & Storage Additional SDKs you are using (Facebook, AdMob, etc.): Facebook, GoogleSignIn (https://github.com/googlesamples/google-signin-unity) Platform you are using the Unity editor on (Mac, Windows, or Linux): Mac Platform you are targeting (iOS, Android, and/or desktop): iOS XCode version: 10.1 (10B61) Cocoapods version: 1.7.3 Pods integrated with: Workspace Podfile:

source 'https://github.com/CocoaPods/Specs.git' platform :ios, '9.0'

target 'Unity-iPhone' do pod 'Bolts', '~> 1.7' pod 'FBSDKCoreKit', '~> 5.1' pod 'FBSDKLoginKit', '~> 5.1' pod 'FBSDKShareKit', '~> 5.1' pod 'Firebase/Analytics', '6.3.0' pod 'Firebase/Auth', '6.3.0' pod 'Firebase/Core', '6.3.0' pod 'Firebase/Database', '6.3.0' pod 'Firebase/Messaging', '6.3.0' pod 'Firebase/Storage', '6.3.0' pod 'GoogleSignIn', '>= 4.0.2' end

Please describe the issue here:

(Please list the full steps to reproduce the issue. Include device logs, Unity logs, and stack traces if available.) 1.- Build the Unity project to an XCode project (File->Build Settings->Build) 2.- Open Terminal, go to project folder, run 'pod install' 3.- Open theb .xcworkspace file generated when building the project 4.- Add 'UserNotifications' to the Linked Frameworks and Libraries (to make Messaging work) 5.- Enable Capabilities: Background Modes(remote notifications), In-App Purchase, Push Notifications 6.- In Build Settings, set Enable Bitcode to False (because if not, it throws an error: clang: error: unable to execute command: Segmentation fault: 11) 7.- Press the "Play" button in the top bar to run the app in the attached device 8.- Error thrown when doing "Build" process:

Undefined symbols for architecture armv7: "_OBJCCLASS$_FIRDynamicLinks", referenced from: objc-class-ref in libFirebaseCppApp.a(invites_receiver_internal_ios_fe43142c9b5429d3e0c956b7297ce932.o) ld: symbol(s) not found for architecture armv7 clang: error: linker command failed with exit code 1 (use -v to see invocation)

Full stacktrace:

Ld /Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/iOSUnPuzzle.app/iOSUnPuzzle normal armv7 (in target: Unity-iPhone) cd /Users/unpuzzle/Documents/Builds/TestNewVersionBuild export IPHONEOS_DEPLOYMENT_TARGET=9.0 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS12.1.sdk -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/Bolts -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FBSDKCoreKit -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FBSDKLoginKit -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FBSDKShareKit -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FirebaseAuth -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FirebaseCore -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FirebaseDatabase -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FirebaseInstanceID -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FirebaseMessaging -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/FirebaseStorage -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/GTMSessionFetcher -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/GoogleToolboxForMac -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/GoogleUtilities -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/Protobuf -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/leveldb-library -L/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/nanopb -L/Users/unpuzzle/Documents/Builds/TestNewVersionBuild -L/Users/unpuzzle/Documents/Builds/TestNewVersionBuild/Libraries -L/Users/unpuzzle/Documents/Builds/TestNewVersionBuild/Libraries/Plugins/iOS/Firebase -F/Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos -F/Users/unpuzzle/Documents/Builds/TestNewVersionBuild/Pods/FirebaseAnalytics/Frameworks -F/Users/unpuzzle/Documents/Builds/TestNewVersionBuild/Pods/GoogleAppMeasurement/Frameworks -F/Users/unpuzzle/Documents/Builds/TestNewVersionBuild/Pods/GoogleSignIn/Frameworks -F/Users/unpuzzle/Documents/Builds/TestNewVersionBuild/Frameworks/GoogleMapsView/Scripts/Editor/Libs/iOS/Frameworks -filelist /Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/iOSUnPuzzle.LinkFileList -Xlinker -map -Xlinker /Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/iOSUnPuzzle-LinkMap-normal-armv7.txt -miphoneos-version-min=9.0 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/iOSUnPuzzle_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -ObjC -lBolts -lFBSDKCoreKit -lFBSDKLoginKit -lFBSDKShareKit -lFirebaseAuth -lFirebaseCore -lFirebaseDatabase -lFirebaseInstanceID -lFirebaseMessaging -lFirebaseStorage -lGTMSessionFetcher -lGoogleToolboxForMac -lGoogleUtilities -lProtobuf -lc++ -licucore -lleveldb-library -lnanopb -lsqlite3 -lz -framework CFNetwork -framework CoreGraphics -framework CoreText -framework FIRAnalyticsConnector -framework FirebaseAnalytics -framework FirebaseCoreDiagnostics -framework Foundation -framework GoogleAppMeasurement -framework GoogleSignIn -framework LocalAuthentication -framework MobileCoreServices -framework SafariServices -framework Security -framework StoreKit -framework SystemConfiguration -weak_framework Accounts -weak_framework AudioToolbox -weak_framework CoreGraphics -weak_framework CoreLocation -weak_framework Foundation -weak_framework QuartzCore -weak_framework Security -weak_framework Social -weak_framework UIKit -weak_framework UserNotifications -weak_framework CoreMotion -weak-lSystem -all_load -ObjC -framework UserNotifications -framework Security -framework MediaToolbox -liPhone-lib -framework CoreText -framework AudioToolbox -weak_framework AVFoundation -framework AVKit -framework CFNetwork -framework CoreGraphics -framework CoreMedia -weak_framework CoreMotion -framework CoreVideo -framework Foundation -framework OpenAL -framework OpenGLES -framework QuartzCore -framework SystemConfiguration -framework UIKit -liconv.2 -lil2cpp -lFirebaseCppAuth -framework GoogleMaps -lFirebaseCppMessaging -lFirebaseCppAnalytics -framework GoogleMapsCore -lFirebaseCppDatabase -lFirebaseCppApp -framework GoogleMapsBase -lFirebaseCppStorage -framework MobileCoreServices -framework MessageUI -framework EventKit -framework LocalAuthentication -framework ContactsUI -framework CoreLocation -weak_framework Metal -lPods-Unity-iPhone -lc++ -lz -framework Accelerate -framework CoreData -framework CoreImage -framework StoreKit -framework CoreTelephony -framework GLKit -framework ImageIO -Xlinker -dependency_info -Xlinker /Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Intermediates.noindex/Unity-iPhone.build/Debug-iphoneos/Unity-iPhone.build/Objects-normal/armv7/iOSUnPuzzle_dependency_info.dat -o /Users/unpuzzle/Library/Developer/Xcode/DerivedData/Unity-iPhone-dtmscsjqtzadphaparbluttimilg/Build/Products/Debug-iphoneos/iOSUnPuzzle.app/iOSUnPuzzle

Please answer the following, if applicable:

Have you been able to reproduce this issue with just the Firebase Unity quickstarts (this GitHub project)? Since I have more than 1 plugin in use in my project, I don't know which may be causing it, so I haven't tested any quickstart project. But what I did was create a new empty project, add the 5 plugins and test if the same issue happened. It completed the build without any errors.

I also have deleted all the references of the plugin and reimported everything again. Please help! I am not using the Dynamic Links plugin from firebase (I assume the error has to do with it since in the error this keywords appear), why is it referencing it?

TonyaGitHub commented 5 years ago

In the Podfile, some lines are "crossed" because of the '~' character.

kunal2619 commented 5 years ago

Facing the same issue with version 6.1.1 as well. I am using Analytics, Auth, Database Crashlytics and Messaging. Any solutions?

podfile: source 'https://github.com/CocoaPods/Specs.git' platform :ios, '11.0'

In the Podfile, some lines are "crossed" because of the '~' character. target 'Unity-iPhone' do pod 'Bolts', '~> 1.7' pod 'Crashlytics', '3.13.1' pod 'Fabric', '1.10.1' pod 'FBSDKCoreKit', '~> 5.1' pod 'FBSDKLoginKit', '~> 5.1' pod 'FBSDKShareKit', '~> 5.1' pod 'Firebase/Analytics', '6.1.0' pod 'Firebase/Auth', '6.1.0' pod 'Firebase/Core', '6.1.0' pod 'Firebase/Database', '6.1.0' pod 'Firebase/Messaging', '6.1.0' end

a-maurice commented 5 years ago

Hi all. So normally some of the dynamic links code lives in the Firebase App library, since previously both invites and dynamic links shared it. However, normally if the code is not used then it would just be ignored, but for whatever reason it is not for you all. Unfortunately I haven't been able to reproduce the problem yet with just the Firebase libraries, so I'm guessing it might be getting caused by one of the extra plugins you mentioned.

If you could narrow it down by including them one at a time, that would be very helpful. Meanwhile, what happens if you include the Firebase Dynamic Links library?

TonyaGitHub commented 5 years ago

Hello, thanks for the reply. I find it pretty wierd that from another plugin it is accessing a Firebase library that isn't even in the project. I remind you that it only happened after upgrading the Firebase version to 6.2.0, I didn't change anything else. However, I'll test what you recommended me. First, including the dynamic link SDK and then removing & adding the plugins one by one. Whenever I have the results, I will write back!

TonyaGitHub commented 5 years ago

I have added the Dynamic Links SDK and it builds without any errors now. I'll leave it like this for now.

hzor3000 commented 5 years ago

@stewartmiles Please be informed that we did not use Dynamic Links before and we do not have any reason to use it now. We are not confident that adding it as a workaround will not cause other conflicts.

Could you please confirm that there is not other solution for this issue.

Should this be labeled as a bug?!

Thanks in advance for the response.

stewartmiles commented 5 years ago

@hzor3000 this is the intended behavior. We ship static libraries for iOS that have references to symbols that will be dead stripped when the library is linked. This code has been present in our shared component (app library) for years see https://github.com/firebase/firebase-cpp-sdk/tree/master/app/src/invites/ios . As @a-maurice mentioned, the fact you're seeing this issue when using plugins other than Firebase suggests that something else is setting the flag --no-undefined. https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang-undefined-arg

If you really want to still set --no-undefined you'll have to exclude FIRDynamicLinks

chkuang-g commented 4 years ago

Closing this issue because no response for 2 weeks.

reflexing commented 4 years ago

Facebook did this: https://github.com/facebook/facebook-sdk-for-unity/issues/255 It's not --no-undefined, it's -all_load linker flag.

Looks like they fixed it already: https://github.com/facebook/facebook-sdk-for-unity/search?q=all_load&type=Commits

stewartmiles commented 4 years ago

@reflexing I've followed up with the Facebook folks as -all_load seems like a bad thing to do when developers are including multiple SDKs.