firebase / firebase-unity-sdk

The Firebase SDK for Unity
http://firebase.google.com
Apache License 2.0
236 stars 39 forks source link

[FR] Support Unity Server Builds #232

Open gabetoth-alder opened 2 years ago

gabetoth-alder commented 2 years ago

Our mobile project has a multiplayer server which will run on linux. We build the server with Target Platform set to linux and Server Build ticked on the Build Settings window in Unity Editor on Windows.

When the server starts the attached log message is seen. server_crash.txt This part at the end hints that the libs aren't loaded:

Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/FirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/FirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/FirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/FirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/FirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0.so
Fallback handler could not load library /local/game/server_Data/Mono/libFirebaseCppApp-8_9_0
Could not resolve all Firebase dependencies System.TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. ---> System.TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. ---> System.DllNotFoundException: FirebaseCppApp-8_9_0
  at (wrapper managed-to-native) Firebase.AppUtilPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_AppUtil(Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate)
  at Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <5832818f1ad84593aa2717f5b3d23851>:0
   --- End of inner exception stack trace ---
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at Firebase.AppUtilPINVOKE..cctor () [0x00000] in <5832818f1ad84593aa2717f5b3d23851>:0
   --- End of inner exception stack trace ---
  at Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) [0x00000] in <5832818f1ad84593aa2717f5b3d23851>:0
  at Firebase.LogUtil..ctor () [0x0001e] in <5832818f1ad84593aa2717f5b3d23851>:0
  at Firebase.LogUtil..cctor () [0x00010] in <5832818f1ad84593aa2717f5b3d23851>:0
   --- End of inner exception stack trace ---
  at Firebase.FirebaseApp..cctor () [0x0004a] in <5832818f1ad84593aa2717f5b3d23851>:0
   --- End of inner exception stack trace ---
  at Framework.Core.Managers.FirebaseInstaller+<Initialize>d__6.MoveNext () [0x0001e] in <98c85913016548029f68f9361c660fef>:0
Waiting for managers.
Uploading Crash Report
DllNotFoundException: FirebaseCppApp-8_9_0
  at (wrapper managed-to-native) Firebase.AppUtilPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_AppUtil(Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate)
  at Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () [0x000ee] in <5832818f1ad84593aa2717f5b3d23851>:0
Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception.
  at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
  at Firebase.AppUtilPINVOKE..cctor () [0x00000] in <5832818f1ad84593aa2717f5b3d23851>:0
Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception.
  at Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) [0x00000] in <5832818f1ad84593aa2717f5b3d23851>:0
  at Firebase.LogUtil..ctor () [0x0001e] in <5832818f1ad84593aa2717f5b3d23851>:0
  at Firebase.LogUtil..cctor () [0x00010] in <5832818f1ad84593aa2717f5b3d23851>:0
Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception.
  at Firebase.FirebaseApp..cctor () [0x0004a] in <5832818f1ad84593aa2717f5b3d23851>:0
Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception.
  at Framework.Core.Managers.FirebaseInstaller+<Initialize>d__6.MoveNext () [0x000d2] in <98c85913016548029f68f9361c660fef>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <695d1cc93cca45069c528c15c9fdd749>:0
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__6_0 (System.Object state) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0
  at UnityEngine.UnitySynchronizationContext+WorkRequest.Invoke () [0x00002] in <a3bf785675754762a66d8639375071d6>:0
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
UnityEngine.WorkRequest:Invoke()
UnityEngine.UnitySynchronizationContext:Exec()
UnityEngine.UnitySynchronizationContext:ExecuteTasks()

Details:

gabetoth-alder commented 2 years ago

Update:

I managed to reproduce the crash with a vanilla empty project with just firebase auth added to it and a MonoBehaviour with just the dependency checking

gabetoth-alder commented 2 years ago

Update:

I ticked Load on startup for the .so files in editor and after that I got some more logs:

Plugins: Couldn't open /home/ec2-user/linuxserver/server_Data/Plugins/FirebaseCppApp-8_9_0.so, error: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by /home/ec2-user/linuxserver/server_Data/Plugins/FirebaseCppApp-8_9_0.so)
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 LoadPluginExecutable(char const*, bool)
 #3 FindAndLoadUnityPlugin(char const*, void**, bool)
 #4 PluginsInitializePreloadedPlugins()
 #5 CallbackArray::Invoke()
 #6 PlayerInitEngineNoGraphics(core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&)
 #7 PlayerMain(int, char**)
 #8 __libc_start_main
 #9 _start

Plugins: Couldn't open /home/ec2-user/linuxserver/server_Data/Plugins/FirebaseCppAuth.so, error: libc++.so: cannot open shared object file: No such file or directory
 #0 GetStacktrace(int)
 #1 DebugStringToFile(DebugStringToFileData const&)
 #2 LoadPluginExecutable(char const*, bool)
 #3 FindAndLoadUnityPlugin(char const*, void**, bool)
 #4 PluginsInitializePreloadedPlugins()
 #5 CallbackArray::Invoke()
 #6 PlayerInitEngineNoGraphics(core::basic_string<char, core::StringStorageDefault<char> > const&, core::basic_string<char, core::StringStorageDefault<char> > const&)
 #7 PlayerMain(int, char**)
 #8 __libc_start_main
 #9 _start

/lib64/libm.so.6 exist, but the version is mismatching, AL2 is using 2.26 and some other components have dependencies for it libc++.so doesn't even exists anywhere, my guess if I fix the first one it might fix this one to.

chkuang-g commented 2 years ago
  1. Did it start to happen after you upgrade or this just happen after you add Firebase into your server project?
  2. Could you elaborate what you mean by We build the server with Target Platform set to linux and Server Build ticked on the Build Settings window in Unity Editor on Windows.? Are you build the instance on Linux and run it on Windows?
  3. Could you detailed the reproduction steps and let us know in which environment that it works and which not?

Thanks, Shawn

google-oss-bot commented 2 years ago

Hey @gabetoth-alder. 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!

gabetoth-alder commented 2 years ago
  1. Did it start to happen after you upgrade or this just happen after you add Firebase into your server project?
  2. Could you elaborate what you mean by We build the server with Target Platform set to linux and Server Build ticked on the Build Settings window in Unity Editor on Windows.? Are you build the instance on Linux and run it on Windows?
  3. Could you detailed the reproduction steps and let us know in which environment that it works and which not?

Thanks, Shawn

  1. It happened with every version we tried.
  2. we built it on windows for linux. (windows editor set to standalone linux target platform)
chadrockey commented 2 years ago
Screen Shot 2022-08-17 at 6 05 37 PM

I'm also seeing this issue, seems whenever File -> Build Settings is set to Dedicated Server under Platform, the needed files are packaged but can't load when the application tries to run.

I setup an anonymous login project and still see the issue.

Source code (attached to the Light):

    // Start is called before the first frame update
    void Start()
    {
        Firebase.Auth.FirebaseAuth auth = Firebase.Auth.FirebaseAuth.DefaultInstance;

        auth.SignInAnonymouslyAsync().ContinueWith(task => {
        if (task.IsCanceled) {
            Debug.LogError("SignInAnonymouslyAsync was canceled.");
            return;
        }
        if (task.IsFaulted) {
            Debug.LogError("SignInAnonymouslyAsync encountered an error: " + task.Exception);
            return;
        }

        Firebase.Auth.FirebaseUser newUser = task.Result;
        Debug.LogFormat("User signed in successfully: {0} ({1})",
            newUser.DisplayName, newUser.UserId);
        });
    }
Error log when run on Linux Server.  Windows server outputs very similar errors:

Begin MonoManager ReloadAssembly

  • Completed reload, in 0.085 seconds ERROR: Shader Sprites/Default shader is not supported on this GPU (none of subshaders/fallbacks are suitable) ERROR: Shader Sprites/Mask shader is not supported on this GPU (none of subshaders/fallbacks are suitable) UnloadTime: 0.613160 ms Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/FirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0.so Fallback handler could not load library /home/chad/FirebaseTest_Data/MonoBleedingEdge/x86_64/libFirebaseCppApp-9_4_0 DllNotFoundException: FirebaseCppApp-9_4_0 assembly: type: member:(null) at (wrapper managed-to-native) Firebase.AppUtilPINVOKE+SWIGExceptionHelper.SWIGRegisterExceptionCallbacks_AppUtil(Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate,Firebase.AppUtilPINVOKE/SWIGExceptionHelper/ExceptionDelegate) at Firebase.AppUtilPINVOKE+SWIGExceptionHelper..cctor () [0x000ef] in :0 Rethrow as TypeInitializationException: The type initializer for 'SWIGExceptionHelper' threw an exception. at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr) at Firebase.AppUtilPINVOKE..cctor () [0x00000] in :0 Rethrow as TypeInitializationException: The type initializer for 'Firebase.AppUtilPINVOKE' threw an exception. at Firebase.AppUtil.SetLogFunction (Firebase.LogUtil+LogMessageDelegate arg0) [0x00001] in :0 at Firebase.LogUtil..ctor () [0x0000f] in :0 at Firebase.LogUtil..cctor () [0x00011] in :0 Rethrow as TypeInitializationException: The type initializer for 'Firebase.LogUtil' threw an exception. at Firebase.FirebaseApp..cctor () [0x0004b] in :0 Rethrow as TypeInitializationException: The type initializer for 'Firebase.FirebaseApp' threw an exception. at Firebase.Auth.FirebaseAuth.get_DefaultInstance () [0x00001] in <8f5fac01dc2245278fcb9acf081ab3cc>:0 at LightFirebase.Start () [0x00000] in <3bf8aacd454f4e3aaadc3eaa51e662ef>:0

@gabetoth-alder Were you able to find a resolution?

chadrockey commented 2 years ago

@gabetoth-alder @chkuang-g I don't know why our Windows tests of this same Dedicated Server build were failing, but I found a fix for Linux dedicated servers.

They need sudo apt-get install libsecret-1-dev to be installed. image

After this I was able to proof of concept anonymous authorization followed by reading a Firestore document.

gabetoth-alder commented 2 years ago

@chadrockey

Were you able to find a resolution?

Not yet. I managed to have my server run firebase-free, since only game logic runs on it, but for later it would be nice to make it work.

I don't know why our Windows tests of this same Dedicated Server build were failing, but I found a fix for Linux dedicated servers. They need sudo apt-get install libsecret-1-dev to be installed. After this I was able to proof of concept anonymous authorization followed by reading a Firestore document.

Sounds great! I will test it this week hopefully, I'm working on other things right now!

dev-cmurphy commented 2 years ago

Hi! Just to say I have the same issue on my side. sudo apt-get install libsecret-1-dev did not work for me.

I'm running automated tests with GameCI on a GitHub Actions Ubuntu free instance.

chkuang-g commented 2 years ago

@chadrockey

Thank you for finding the solution by running sudo apt-get install libsecret-1-dev on the dedicated server. Let me talk to the team and see if this is expected on Linux and to update the document.

@gabetoth-alder Please let us know if this solution works for you.

@dev-cmurphy For game.ci related discussion, please use this thread https://github.com/firebase/firebase-unity-sdk/issues/449. Let's separate them until we can verify if they are the same issue. Thank you :)

google-oss-bot commented 2 years ago

Hey @gabetoth-alder. 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!

chadrockey commented 2 years ago

Please do not mark as stale, would really like an official resolution for running with dedicated server builds

google-oss-bot commented 2 years ago

Hey @gabetoth-alder. 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!

gabetoth-alder commented 2 years ago

Sorry for my late update, I got the following results:

For AWS GameLift we have an install.sh script:

sudo yum -y update
sudo yum -y install libsecret-1-dev

The update runs as expected, but the install libsecret-1-dev fails:

No package libsecret-1-dev available.
Error: Nothing to do

I had my servers working on ubuntu instances without any problem, but GameLift uses 'AMAZON_LINUX_2' inhouse OS.

AlmostMatt commented 2 years ago

Is this a case of the libsecret package having a different name on different OS? I found this page which suggests that libsecret-devel is available on Amazon Linux 2 http://213.146.141.13/package/details/OracleLinux7/x86_64/x86-64/libsecret/0.18.6

google-oss-bot commented 2 years ago

Hey @gabetoth-alder. 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!

gabetoth-alder commented 2 years ago

Is this a case of the libsecret package having a different name on different OS? I found this page which suggests that libsecret-devel is available on Amazon Linux 2 http://213.146.141.13/package/details/OracleLinux7/x86_64/x86-64/libsecret/0.18.6

================================================================================
 Package              Arch        Version                 Repository       Size
================================================================================
Installing:
 libsecret-devel      x86_64      0.18.5-2.amzn2.0.2      amzn2-core       93 k
Installing for dependencies:
 glib2-devel          x86_64      2.56.1-9.amzn2.0.2      amzn2-core      453 k
 libsecret            x86_64      0.18.5-2.amzn2.0.2      amzn2-core      153 k
 pcre-devel           x86_64      8.32-17.amzn2.0.2       amzn2-core      480 k

Transaction Summary
================================================================================
Install  1 Package (+3 Dependent packages)

Total download size: 1.2 M
Installed size: 6.0 M
Downloading packages:
--------------------------------------------------------------------------------
Total                                              4.9 MB/s | 1.2 MB  00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : pcre-devel-8.32-17.amzn2.0.2.x86_64                          1/4 
  Installing : glib2-devel-2.56.1-9.amzn2.0.2.x86_64                        2/4 
  Installing : libsecret-0.18.5-2.amzn2.0.2.x86_64                          3/4 
  Installing : libsecret-devel-0.18.5-2.amzn2.0.2.x86_64                    4/4 
  Verifying  : libsecret-0.18.5-2.amzn2.0.2.x86_64                          1/4 
  Verifying  : libsecret-devel-0.18.5-2.amzn2.0.2.x86_64                    2/4 
  Verifying  : pcre-devel-8.32-17.amzn2.0.2.x86_64                          3/4 
  Verifying  : glib2-devel-2.56.1-9.amzn2.0.2.x86_64                        4/4 

Installed:
  libsecret-devel.x86_64 0:0.18.5-2.amzn2.0.2                                   

Dependency Installed:
  glib2-devel.x86_64 0:2.56.1-9.amzn2.0.2 libsecret.x86_64 0:0.18.5-2.amzn2.0.2
  pcre-devel.x86_64 0:8.32-17.amzn2.0.2  

Complete!

I confirm that I was able to install the package, I will check the server logs later, I my server crashed for another unrelated issue

Edit: It didn't work, server log:

Mono path[0] = '/local/game/server_Data/Managed'
Mono config path = '/local/game/server_Data/MonoBleedingEdge/etc'
Unable to preload the following plugins:
        FirebaseCppAnalytics.so
        FirebaseCppApp-9_4_0.so
        FirebaseCppAuth.so
        FirebaseCppDatabase.so
        FirebaseCppDynamicLinks.so
        FirebaseCppMessaging.so
        libsqlite3.so
DellaBitta commented 2 years ago

Hi all,

Just for clarity the Firebase Unity SDK doesn't officially support server builds. We don't build and test this scenario either, so we don't have a full working knowledge of the trails you're blazing. Please upvote this issue so that we can prioritize it on our roadmap.

The more information that you can provide to use the better as maybe something will jump out at us as something that we've encountered in other tested scenarios.

Unless I'm wrong this seems to be a missing dependency issue attempting to resolve libraries on various flavors of Linux. Potentially the Amazon versions of libsecret are incompatible with the ones that the Firebase SDK requires, and though the Firebase .so files are found they can't be loaded in conjunction with the platform's libraries.

We mainly test against Ubuntu and I believe that Amazon Linux is either CentOS or Fedora, depending on which version of Amazon Linux you're using. There could be a mismatch there?

@gabetoth-alder, in your latest attempt was there any output beyond Unable to preload the following plugins:? Is there more debug information that can be enabled?

Thanks!

gabetoth-alder commented 2 years ago

Just for clarity the Firebase Unity SDK doesn't officially support server builds. We don't build and test this scenario either, so we don't have a full working knowledge of the trails you're blazing. Please upvote this issue so that we can prioritize it on our roadmap.

Yes it would be great, it can have a lot of benefits.

Unless I'm wrong this seems to be a missing dependency issue attempting to resolve libraries on various flavors of Linux. Potentially the Amazon versions of libsecret are incompatible with the ones that the Firebase SDK requires, and though the Firebase .so files are found they can't be loaded in conjunction with the platform's libraries.

We mainly test against Ubuntu and I believe that Amazon Linux is either CentOS or Fedora, depending on which version of Amazon Linux you're using. There could be a mismatch there?

Probably there is something missing in the Amazon Linux.

@gabetoth-alder, in your latest attempt was there any output beyond Unable to preload the following plugins:? Is there more debug information that can be enabled?

I cannot add anything else at this point, my server is built to work without firebase (I moved stuff needed to the client, which is is... ok for the current project, but creates limits), so it doesn't crash or produce any more issues. Before that it crashed at the dependency check.

DellaBitta commented 2 years ago

Ok, I'm going to rework this ticket as a feature request for server builds, and keep the ticket open so we can prioritize it properly.

Please upvote this issue if you're looking to use server builds with our SDK. Thanks!

DrProfesor commented 1 year ago

Any updates on this? I am running into this issue with servers running on Unitys Multiplay.

DannyKrendel commented 1 year ago

Having the same issue with Unity Multiplay.

Any updates on this? I am running into this issue with servers running on Unitys Multiplay.

Have you found a solution?

Jeffry15 commented 1 year ago

After some research, I found a workaround that works for Ubuntu Server 23.10, which may work for other Linux systems.

Possibly why the error happens

Firebase .so files is compiled code, and it expects to see some authentication package, this may change depending on what you build for, but the expected package is for desktop editions with a screen, so it's not preinstalled, once installed, they load, but you get an error usually with a log from libsecret (or you dont but Firebase has an exception still), but the error's root cause is dbus (Linux's graphics package) which isn't logged, you can view the error by running: dbus-run-session -- ./<ServerBuildNameHere> you can also see what it wants by navigating to your server build folder/_Data/Plugins (where the firebase.so files are) and then entering ldd * (note that some of them are linked by virtual memory, to the file location is not specified, but only the packages that say 'not found' are missing packages), you might find that afterwards FirebaseCPPApp afterwards says not found, which is likely a visual bug, it is found and loaded when you launch the build, it's also in the logs of the Unity Server build, near the top it says 'preloaded FirebaseApp or preloaded FirebaseAuth all the incompatibility of Unity Server builds for Linux mostly stems from missing packages, or that the missing packages bring errors themselfs.

libsecret-1-0 is one of Linux's authentication package, however for different systems, there may different packages for libsecret available, the one that works with me is libsecret-1-0 and I do have libsecret-1-dev, but it's not there for dev-cmurphy's system (or maybe they haven't updated their package manager yet), systems using Amazon AWS may want libsecret-devel, to see all the available versions in your system, enter apt install libsecret-*, then see the packages listed with a prefix of 'libsecret-' and enter n to not install these packages if you don't want them.

What to do

If your using docker, note that gnome keyring requires root access to the host machine, for security reasons, I recomend running docker run --privileged <your params and image> and do these commands then save the image while the container is running with docker commit <ContainerIdOrName> <NewImageName>, and run the new saved image instead, you can view all images with docker images -a, it should run without --privileged afterwards. Also note that docker forces --privileged to be off next time the container is started, so if you reboot it, it doesn't have root access.

Also note that Firebase sometimes gives their own exception if you do too many failed attempts, it will clearly say it in the logs though as a System.Exception.

If this doesn't work, you can wait for Firebase to support it or troubleshoot it with the information mentioned, I think there's only 2 steps:

This is rough but it's something to go off of for others, and possibly help making support for Unity server builds, hope this helps!

MrGadget1024 commented 9 months ago

Just for clarity the Firebase Unity SDK doesn't officially support server builds. We don't build and test this scenario either, so we don't have a full working knowledge of the trails you're blazing. Please upvote this issue so that we can prioritize it on our roadmap.

+1000 for this. Clients should never touch the database, or even know anything about it, or where it is, or what it is. Game server must have full access, everything client wants / needs flows through game server (plus maybe a separate web service for account creation / auth before connecting to game server). No Firebase libs should be in the client builds.

No idea why you wouldn't have started from that perspective.

jayman2989 commented 8 months ago

Jumping in here to reup and reaffirm support for this request! Our dedicated servers should absolutely be in control of the data writing, and not entrusting that to clients.

felipemullen commented 1 week ago

This issue is coming up on google searches so I want to add a few thoughts here. When building images from Unity's unitymultiplay/linux-base-image, the firebase libraries do not load correctly (starting with 12.x AFAIK), spitting errors like this

2025-01-14 16:30:23 DllNotFoundException: FirebaseCppApp-12_5_0 assembly:<unknown assembly> type:<unknown type> member:(null)

Upon inspection with ldd, you will see mismatching glibc version errors like these

/game/duelo-server-0.0.0_Data/Plugins/FirebaseCppApp-12_5_0.so: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.34' not found (required by /game/duelo-server-0.0.0_Data/Plugins/FirebaseCppApp-12_5_0.so)
/game/duelo-server-0.0.0_Data/Plugins/FirebaseCppApp-12_5_0.so: /lib/x86_64-linux-gnu/libc.so.6: version GLIBC_2.32' not found (required by /game/duelo-server-0.0.0_Data/Plugins/FirebaseCppApp-12_5_0.so)
...

The fix is to use a different base image and configure it according to their documentation (unless you prefer to suffer upgrading all the packages in your dockerfile).

@MrGadget1024 sorry to ping on an old issue, but it has been a long standing feature of firebase database that it was perfectly acceptable to accept client writes, provided that your database rules are setup correctly. In fact, one of the great features of firebase is this very nature, which I have used in serverless apps many times. This is my first time using it in Unity though, is there something else I should be considering?