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

Game crash on Linux, error on libglfw #3191

Closed
MauroFoti opened this issue Oct 30, 2023 · 9 comments
Closed

Game crash on Linux, error on libglfw #3191

MauroFoti opened this issue Oct 30, 2023 · 9 comments
Labels
platform: linux Linux specific issues status: resolved Job's done!

Comments

@MauroFoti
Copy link

Game Version

v1.18.15

Platform

Linux

Modded

Vanilla

SP/MP

Singleplayer

Description

The game simply crashes on launch, saying that it is "Unable to load shared library 'glfw'", nor in the dotnet directory or in the game directory.

I've noticed that there's a libglfw.so.3.3 library in VintageStory/Lib, so I tried making a symlink without the version name (libglfw.so -> libglfw.so.3.3). However, this just made the game crash with a different message. I have pasted both logs below.

Game v1.18.10 works without any problem. The system is Linux Mint 20.3 (based on ubuntu 20.04). dotnet version is 7.0.403

How to reproduce

  1. Launch the game
  2. Game crashes

Screenshots

No response

Logs

First crash log, from vanilla game

Running on 64 bit Linux with 16019 MB RAM
Game Version: v1.18.15 (Stable)
30/10/2023 23:41:27: Critical error occurred
Loaded Mods: 
System.TypeInitializationException: The type initializer for 'OpenTK.Windowing.Desktop.Monitors' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'glfw' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.LoadLibrary(String libraryName, Version version, Assembly assembly, Nullable`1 searchPath)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.<>c.<.cctor>b__3_0(String name, Assembly assembly, Nullable`1 path)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.glfwSetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFW.SetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.Desktop.GLFWProvider.EnsureInitialized()
   at OpenTK.Windowing.Desktop.Monitors..cctor()
   --- End of inner exception stack trace ---
   at OpenTK.Windowing.Desktop.Monitors.GetPrimaryMonitor()
   at VSPlatform.XPlatImpl.GetScreenSize() in XPlatformInterface\PlatformFormsImpl.cs:line 30
   at Vintagestory.Client.NoObf.ClientPlatformWindows..ctor(Logger logger) in VintagestoryLib\Client\ClientPlatform\GameWindow.cs:line 62
   at Vintagestory.Client.ClientProgram.Start(ClientProgramArgs args, String[] rawArgs) in VintagestoryLib\Client\ClientProgram.cs:line 167
   at Vintagestory.Client.ClientProgram.<>c__DisplayClass9_0.<.ctor>b__1() in VintagestoryLib\Client\ClientProgram.cs:line 129
   at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93
System.DllNotFoundException: Unable to load shared library 'glfw' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.LoadLibrary(String libraryName, Version version, Assembly assembly, Nullable`1 searchPath)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.<>c.<.cctor>b__3_0(String name, Assembly assembly, Nullable`1 path)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.glfwSetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFW.SetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.Desktop.GLFWProvider.EnsureInitialized()
   at OpenTK.Windowing.Desktop.Monitors..cctor()

Second log, after creating a symlink to libglfw.so.3.3

Running on 64 bit Linux with 16019 MB RAM
Game Version: v1.18.15 (Stable)
30/10/2023 23:42:31: Critical error occurred
Loaded Mods: 
System.TypeInitializationException: The type initializer for 'OpenTK.Windowing.Desktop.Monitors' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'glfw' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw.so: cannot open shared object file: No such file or directory
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw.so)
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.LoadLibrary(String libraryName, Version version, Assembly assembly, Nullable`1 searchPath)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.<>c.<.cctor>b__3_0(String name, Assembly assembly, Nullable`1 path)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.glfwSetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFW.SetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.Desktop.GLFWProvider.EnsureInitialized()
   at OpenTK.Windowing.Desktop.Monitors..cctor()
   --- End of inner exception stack trace ---
   at OpenTK.Windowing.Desktop.Monitors.GetPrimaryMonitor()
   at VSPlatform.XPlatImpl.GetScreenSize() in XPlatformInterface\PlatformFormsImpl.cs:line 30
   at Vintagestory.Client.NoObf.ClientPlatformWindows..ctor(Logger logger) in VintagestoryLib\Client\ClientPlatform\GameWindow.cs:line 62
   at Vintagestory.Client.ClientProgram.Start(ClientProgramArgs args, String[] rawArgs) in VintagestoryLib\Client\ClientProgram.cs:line 167
   at Vintagestory.Client.ClientProgram.<>c__DisplayClass9_0.<.ctor>b__1() in VintagestoryLib\Client\ClientProgram.cs:line 129
   at Vintagestory.ClientNative.CrashReporter.Start(ThreadStart start) in VintagestoryLib\Client\ClientPlatform\ClientNative\CrashReporter.cs:line 93
System.DllNotFoundException: Unable to load shared library 'glfw' or one of its dependencies. In order to help diagnose loading problems, consider using a tool like strace. If you're using glibc, consider setting the LD_DEBUG environment variable: 
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw.so: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw.so: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw.so: cannot open shared object file: No such file or directory
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw.so)
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/glfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/glfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/libglfw: cannot open shared object file: No such file or directory
/usr/share/dotnet/shared/Microsoft.NETCore.App/7.0.13/libglfw: cannot open shared object file: No such file or directory
/mnt/12a8c352-84a3-46e9-a3b3-20a09b8cebd3/opt/vintagestory/1.18.15/Lib/libglfw: cannot open shared object file: No such file or directory

   at System.Runtime.InteropServices.NativeLibrary.LoadByName(String libraryName, QCallAssembly callingAssembly, Boolean hasDllImportSearchPathFlag, UInt32 dllImportSearchPathFlag, Boolean throwOnError)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryByName(String libraryName, Assembly assembly, Nullable`1 searchPath, Boolean throwOnError)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.LoadLibrary(String libraryName, Version version, Assembly assembly, Nullable`1 searchPath)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.<>c.<.cctor>b__3_0(String name, Assembly assembly, Nullable`1 path)
   at System.Runtime.InteropServices.NativeLibrary.LoadLibraryCallbackStub(String libraryName, Assembly assembly, Boolean hasDllImportSearchPathFlags, UInt32 dllImportSearchPathFlags)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFWNative.glfwSetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.GraphicsLibraryFramework.GLFW.SetErrorCallback(ErrorCallback callback)
   at OpenTK.Windowing.Desktop.GLFWProvider.EnsureInitialized()
   at OpenTK.Windowing.Desktop.Monitors..cctor()
@MauroFoti MauroFoti added the status: new This issue is fresh! label Oct 30, 2023
@Th3Dilli
Copy link
Member

Th3Dilli commented Nov 7, 2023

What exact distribution are you using? and can you tell the output from
ldd --version please?

It might be an issue with libglfw being compiled with a newer version of GLIBC then your OS ships.

further you can test this by setting
the LD_DEBUG env var and starting the game this way form terminal
LD_DEBUG=libs ./Vintagestory

@AedisV
Copy link

AedisV commented Nov 7, 2023

Hello,
I have simillar issue, (on devuan), and copying libglfw from older game build does help, alternatively also helps to LD_PRELOAD older version of libglfw 3.3 (older as in older build) because new one asks for new glibc, which can be verified using ldd,
ldd in this case (in game directory)

$ ldd Lib/libglfw.so.3.3
Lib/libglfw.so.3.3: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by Lib/libglfw.so.3.3)
	linux-vdso.so.1 (0x00007ffc897b2000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f30c0c53000)
[..]

while older builds of game contained one that was happy on my system with glibc 2.28
I am not certain from which of 1.18 I grabbed this one but mdsums indicate it was 1.18.8 (and same trick works for me with 1.19rc4/5)
I can elaborate more why it causes crash but I doubt it is any important for issue itself.
Hope that helps

@Th3Dilli
Copy link
Member

@AedisV so it works fine if you use a 3.3 from your system package manager that is build using a older version of GLIBC?

@AedisV
Copy link

AedisV commented Dec 21, 2023

@AedisV so it works fine if you use a 3.3 from your system package manager that is build using a older version of GLIBC?
Yes, as I wrote in ticket elsewhere, problem is that libglfw wants particular tagged glibc, which makes dlopen() call fail (as it should as it can't resolve symbols) so it returns nullptr (again as it should), then code somewhere upper in c# does not understand this kind of signalling and tries blindly to access some certain symbol (relative to base address of loaded library which is null) then it gets nullptr deref and crash to ground.
sorry for late reply I have github mails probably -too- well blocked.

@Craluminum2413 Craluminum2413 added the platform: linux Linux specific issues label Dec 21, 2023
@Th3Dilli
Copy link
Member

I just tested and for systems that are older, it should work fine to just install the system package for glfw and remove the libglfw file from the game install Lib folder. Then the library loader will automatically search the system path for it and load it

@AedisV
Copy link

AedisV commented Dec 22, 2023

Yes, but my distro (devuan beowulf) has only 3.2, game asks for 3.3 so it does not pick up system one. Maybe run sh on linux could get few lines with ldd checking if libraries provided in libs would have chance to load and if not emit message instead of starting and crashing?

@Th3Dilli
Copy link
Member

Th3Dilli commented Dec 27, 2023

Can you test this version for me?

This is build using a debian:oldoldstable which as of now is debian 10 and should require GLIBC 2.28 only

libglfw.zip

upstream PR for ref
opentk/glfw-redist#14

@AedisV
Copy link

AedisV commented Dec 27, 2023

It does behave correctly, loads just fine on my system.

@Th3Dilli
Copy link
Member

is now shipped with the game

@Th3Dilli Th3Dilli added status: resolved Job's done! and removed status: new This issue is fresh! labels Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: linux Linux specific issues status: resolved Job's done!
Projects
None yet
Development

No branches or pull requests

4 participants