firebase / quickstart-unity

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

[Bug] DllNotFoundException - Apple Intel #1263

Closed vincentkrp closed 2 years ago

vincentkrp commented 2 years ago

[REQUIRED] Please fill in the following fields:

[REQUIRED] Please describe the issue here:

After importing the FireBaseAuth package into a new Unity project and initializing it with

auth = FirebaseAuth.DefaultInstance

My issue is that when entering play mode I get an error as follows:

DllNotFoundException: FirebaseCppApp-8_9_0 assembly: type: member:(null) Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:117) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. Firebase.AppUtilPINVOKE..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:137) Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/AppUtil.cs:64) Firebase.LogUtil..ctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/LogUtil.cs:81) Firebase.LogUtil..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/LogUtil.cs:37) Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. Firebase.FirebaseApp..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/FirebaseApp.cs:67) Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. AuthManager.Awake () (at Assets/Scripts/AuthManager.cs:34)

Around line 34 which the exception points to I'm executing following code (line 34 in detail is "FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>"): private void Awake() { FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task => { dependencyStatus = task.Result; if (dependencyStatus == DependencyStatus.Available) { //If availabel initialize FireBase InitializeFirebase(); } else { Debug.LogError("Couldn't resolve all Firebase dependencies: " + dependencyStatus); } }); }

At first it may look like it's the same issue as firebase/firebase-unity-sdk#278 , but as far as I've read the issue there was specifically for Apple Silicon (M1) and Intel seemed to work just fine (according to most of the descriptions in that thread)

Additionally I don't get a popup about an untrusted developer for FirebaseCppApp-8_9_0.bundle as it normally should be the case, unless I try to open it manually with the Terminal or Console through Finder.

Steps to reproduce:

I've also tried it out for the quickstart-unity/auth/testapp project and also when entering play-mode I get following error-message in the console:

DllNotFoundException: FirebaseCppApp-8_9_0 assembly: type: member:(null) Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:117) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. Firebase.AppUtilPINVOKE..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/AppUtilPINVOKE.cs:137) Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/AppUtil.cs:64) Firebase.LogUtil..ctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/LogUtil.cs:81) Firebase.LogUtil..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/LogUtil.cs:37) Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. Firebase.FirebaseApp..cctor () (at Z:/tmp/tmp.GOobKx5vLv/firebase/app/client/unity/proxy/FirebaseApp.cs:67) Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. Firebase.Sample.Auth.UIHandler.Start () (at Assets/Firebase/Sample/Auth/UIHandler.cs:80)

Additionally the message on the game-screen puts out:

One or more firebase dependencies are not present. Current dependency status: UnavailableOther

I've also tried out a different FirebaseAuth version (8.8.0) but still getting the same error.

paulinon commented 2 years ago

Hi @vincentkrp,

Thanks for reporting this. When you've encountered the alert saying that Firebase "cannot be opened because the developer cannot be verified", I'd like you to go to your Mac’s System Preferences > Security & Privacy then Click Allow Anyway corresponding to the Firebase bundle file.

Let me know if this solution worked for you. Otherwise, please provide the complete steps you performed before facing this issue.

vincentkrp commented 2 years ago

Like I said before, I don't even get that message in my Security Settings hust through entering play mode. I can only get said message about an unverified developer when navigating to the FirebaseCppApp-8_9_0.bundle file through Finder and the trying to open it via Terminal or Console. And even after allowing this file to be opened anyways it doesn't solve the problem.

As for the steps for encoutering this in the quickstart testproject:

  1. I created and set up a project in the FirebaseConsole for the unity quickstart auth testapp
  2. I downloaded the google-services.json and the firebase unity sdk
  3. I downloaded quickstart-unity-master and added the /auth/testapp/ to my unity-hub
  4. I opened the project and navigated to the Main Scene
  5. I imported the dotnet4/FirebaseAuth.unitypackage through Assets > Import Package > Custom Package
  6. I added the google-services.json to Assets/Firebase/Sample/Auth
  7. I then tried to build for Desktop macOS
  8. The Build was completed and executed and it just showed the following on the screen: One or more firebase dependencies are not present. Current dependency status: UnavailableOther
  9. I closed the build and tried it out in Play-Mode in the Unity-Editor when the DllNotFoundException was presented to me in the Unity-Console
paulinon commented 2 years ago

Thanks for the clarification, @vincentkrp. Version 8.10.0 of the SDK has been released recently. Could you try it out and see if the issue persists?

steffen-roemer commented 2 years ago

same issue for me with 8.10.0

vincentkrp commented 2 years ago

I've tried it with Version 8.10.0 but I still got the same Exception in the Unity-Console

paulinon commented 2 years ago

Thanks for the update, @vincentkrp. Could you try going to Assets/Firebase/Plugins/x86_64/ and confirm if FirebaseCppApp-8_10_0.dll file is present? If so, make sure that's included in "Standalone" and "Editor" builds by looking at the inspector when you select that library. Otherwise, kindly try to re-import the SDK and apply the necessary settings (if necessary) and see if the issue persists.

I look forward to hearing from you soon.

vincentkrp commented 2 years ago

Yes, the file is present (although in my case it's already FirebaseCppApp-8_10_1.dll) and is included in "Editor" and "Standalone" builds. The same applies for the .bundle file (which, I thought, is the important one for macOS)

vincentkrp commented 2 years ago

Update: I've re-imported the Firebase SDK and now and tried to unlock FirebaseCppApp-8_10_1.bundle through usr/bin/xattr -d com.apple.quarantine path/to/project/Assets/Firebase/Plugins/x86_64/FirebaseCppApp-8_10_1.bundle through terminal (didn't throw an error). I also did the corresponding process for FirebaseCppAuth.bundle Then when i tried to enter Play-Mode i first got the Error: Backend produced unparsable log entry eIndex":4} I closed the unity-project and Editor and reopened them. At that point I didn't get the previous Error but again the DllNotFoundException. I thought I'd give this update as it may help figuring out the problem

vincentkrp commented 2 years ago

Another thing I've noticed is that the DllNotFound Exception differs from the one I initially got and stated in my original BugReport. So here's the current one: DllNotFoundException: FirebaseCppApp-8_10_1 assembly:<unknown assembly> type:<unknown type> member:(null) Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/app/swig/Firebase.App_fixed.cs:3842) Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. Firebase.AppUtilPINVOKE..cctor () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/app/swig/Firebase.App_fixed.cs:3862) Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/app/swig/Firebase.App_fixed.cs:4569) Firebase.LogUtil..ctor () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:81) Firebase.LogUtil..cctor () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/app/src/LogUtil.cs:37) Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. Firebase.FirebaseApp..cctor () (at /home/runner/work/firebase-unity-sdk/firebase-unity-sdk/linux_unity/app/swig/Firebase.App_fixed.cs:1852) Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. Firebase.Sample.Auth.UIHandler.Start () (at Assets/Firebase/Sample/Auth/UIHandler.cs:80) (It's from the quickstart-unity/auth/testapp project not from my Project where I had the AuthManager-Script)

a-maurice commented 2 years ago

I would assume it is a problem with the configuration, though I'm not sure what that would be. Just to confirm, if you look at the FirebaseCppApp-8_10_1.bundle, the settings should look like: image

One thing I noticed from testing is if you check the Load on startup option, it will load the bundle file without needing to hit play, which might make any logs or errors more obvious, if you want to try toggling that option (though it should be fine being disabled).

vincentkrp commented 2 years ago

I've already checked multiple times and the settings always look like this, so that shouldn't be the problem

vincentkrp commented 2 years ago

When I check the load on startup option though I am prompted with the following Warning: Plugins: Couldn't open Assets/Firebase/Plugins/x86_64/FirebaseCppApp-8_10_1.bundle, error: dlopen(Assets/Firebase/Plugins/x86_64/FirebaseCppApp-8_10_1.bundle, 2): Symbol not found: _OBJC_CLASS_$_NSConstantIntegerNumber Referenced from: Assets/Firebase/Plugins/x86_64/FirebaseCppApp-8_10_1.bundle (which was built for Mac OS X 11.6) Expected in: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation in Assets/Firebase/Plugins/x86_64/FirebaseCppApp-8_10_1.bundle UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

vincentkrp commented 2 years ago

There's also no such file as Foundation.framework in the /System/Library/Frameworks/-directory. Is this normal?

AlmostMatt commented 2 years ago

On my own device I do see a Foundation.framework in the /System/Library/Frameworks/ directory, and so I do not encounter the same error. I'm not too familiar with how Mac manages such libraries though, so I'm not sure why it would be missing.

Can you indicate what version of Xcode and CocoaPods you have installed, and can you confirm whether or not other frameworks exist in your /System/Library/Frameworks/ directory?

google-oss-bot commented 2 years ago

Hey @vincentkrp. We need more information to resolve this issue but there hasn't been an update in 5 weekdays. I'm marking the issue as stale and if there are no new updates in the next 5 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

google-oss-bot commented 2 years ago

Since there haven't been any recent updates here, I am going to close this issue.

@vincentkrp if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

luckin403 commented 2 years ago

I encountered a similar problem. Do you have any new information on this issue?