mellinoe / vk

Low-level Vulkan bindings for .NET.
Other
176 stars 35 forks source link

Can't load libdl on Linux (Ubuntu Jammy Jellyish) #34

Open 20kdc opened 2 years ago

20kdc commented 2 years ago

I get this with Veldrid 4.8.0 on .NET 6:

20kdc@Magnus:~/Documents/External/space-station-14$ dotnet run --project Pow3r
Renderer: Veldrid
Veldrid API: Vulkan
Fullscreen: False
VSync: True
Unhandled exception. System.TypeInitializationException: The type initializer for 'Vulkan.VulkanNative' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
   at Vulkan.Libdl.dlerror()
   at Vulkan.NativeLibrary.UnixNativeLibrary.LoadLibrary(String libraryName)
   at Vulkan.NativeLibrary..ctor(String libraryName)
   at Vulkan.NativeLibrary.UnixNativeLibrary..ctor(String libraryName)
   at Vulkan.NativeLibrary.Load(String libraryName)
   at Vulkan.VulkanNative.LoadNativeLibrary()
   at Vulkan.VulkanNative..cctor()
   --- End of inner exception stack trace ---
   at Veldrid.Vk.VulkanUtil.EnumerateInstanceLayers()
   at Veldrid.Vk.VkGraphicsDevice.CreateInstance(Boolean debug, VulkanDeviceOptions options)
   at Veldrid.Vk.VkGraphicsDevice..ctor(GraphicsDeviceOptions options, Nullable`1 scDesc, VulkanDeviceOptions vkOptions)
   at Veldrid.Vk.VkGraphicsDevice..ctor(GraphicsDeviceOptions options, Nullable`1 scDesc)
   at Veldrid.GraphicsDevice.CreateVulkan(GraphicsDeviceOptions options, VkSurfaceSource surfaceSource, UInt32 width, UInt32 height)
   at Pow3r.Program.InitVeldrid() in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.Veldrid.cs:line 101
   at Pow3r.Program.InitRenderer() in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.cs:line 357
   at Pow3r.Program.Run(String[] args) in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.cs:line 210
   at Pow3r.Program.Main(String[] args) in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.cs:line 380

I don't know what particular part of this is important here, but looking at https://github.com/mellinoe/vk/commit/14eee159bc293eadedb6830a236165186a26dd0f makes me think it's a case of a change fixing MacOS only to break Linux support. (Obviously I can't be certain of that without recompiling stuff and working out how to use a modified Nuget package locally. If you have any instructions in that regard, send them.)

Beyley commented 2 years ago

I get this with Veldrid 4.8.0 on .NET 6:

20kdc@Magnus:~/Documents/External/space-station-14$ dotnet run --project Pow3r
Renderer: Veldrid
Veldrid API: Vulkan
Fullscreen: False
VSync: True
Unhandled exception. System.TypeInitializationException: The type initializer for 'Vulkan.VulkanNative' threw an exception.
 ---> System.DllNotFoundException: Unable to load shared library 'libdl' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl: cannot open shared object file: No such file or directory
   at Vulkan.Libdl.dlerror()
   at Vulkan.NativeLibrary.UnixNativeLibrary.LoadLibrary(String libraryName)
   at Vulkan.NativeLibrary..ctor(String libraryName)
   at Vulkan.NativeLibrary.UnixNativeLibrary..ctor(String libraryName)
   at Vulkan.NativeLibrary.Load(String libraryName)
   at Vulkan.VulkanNative.LoadNativeLibrary()
   at Vulkan.VulkanNative..cctor()
   --- End of inner exception stack trace ---
   at Veldrid.Vk.VulkanUtil.EnumerateInstanceLayers()
   at Veldrid.Vk.VkGraphicsDevice.CreateInstance(Boolean debug, VulkanDeviceOptions options)
   at Veldrid.Vk.VkGraphicsDevice..ctor(GraphicsDeviceOptions options, Nullable`1 scDesc, VulkanDeviceOptions vkOptions)
   at Veldrid.Vk.VkGraphicsDevice..ctor(GraphicsDeviceOptions options, Nullable`1 scDesc)
   at Veldrid.GraphicsDevice.CreateVulkan(GraphicsDeviceOptions options, VkSurfaceSource surfaceSource, UInt32 width, UInt32 height)
   at Pow3r.Program.InitVeldrid() in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.Veldrid.cs:line 101
   at Pow3r.Program.InitRenderer() in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.cs:line 357
   at Pow3r.Program.Run(String[] args) in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.cs:line 210
   at Pow3r.Program.Main(String[] args) in /home/20kdc/Documents/External/space-station-14/Pow3r/Program.cs:line 380

I don't know what particular part of this is important here, but looking at 14eee15 makes me think it's a case of a change fixing MacOS only to break Linux support. (Obviously I can't be certain of that without recompiling stuff and working out how to use a modified Nuget package locally. If you have any instructions in that regard, send them.)

Known issue, a temporary fix is to make a soft link from /usr/lib/libdl.so.2 -> /usr/lib/libdl.so