spanzeri / vkguide-zig

An implementation of vkguide.dev in the zig programming language
MIT License
95 stars 3 forks source link

error while loading shared libraries: libSDL3.so.0 #1

Closed NippleOfAnApe closed 9 months ago

NippleOfAnApe commented 9 months ago

Hi, when running an executable, I get this error ./zig-out/bin/vkguide-zig: error while loading shared libraries: libSDL3.so.0: cannot open shared object file: No such file or directory

A shared library that you've included is libSDL3.so. Do you know how can I fix this? My zig version is 0.12.0-dev.1092+68ed78775

spanzeri commented 9 months ago

Thanks for the report. That part of the build is indeed wrong. It was working on my system because I appear to have libSDL3 installed on the system. There have been quite a few changes in zig master, so I need to fix the build before I can test how to install/use the local built one. In the meantime, you could try and find (or build and install) SDL3 on your system (assuming linux)

NippleOfAnApe commented 9 months ago

I use void and there's no SDL3 yet, and looking at those dependencies, it'll take me some time to build from source. But I'll try and report.

Also there's zigup to help you control zig versions

spanzeri commented 9 months ago

I have been using ZVM, just because it also supports updating zls alongside zig. Regarding the library, there seems to be some issue with zig build and rpaths which causes other projects to struggle. See: https://github.com/ziglang/zig/issues/15849 Other projects are struggling with it: https://github.com/zig-gamedev/zig-gamedev/issues/312. I will experiment with it and see if I can make it work as soon as I finish my day job (in a few hours) :) If you want to get it to work, you could add to LD_LIBRARY_PATH for your user thirdparty/sdl3/lib temporarily. I will post an update as soon as I have one

NippleOfAnApe commented 9 months ago

I symlinked libSDL3.so.0 in place of original libSDL3.so but get the same error

spanzeri commented 9 months ago

I just pushed a fix. It should copy the library in zig-out/bin, alongside the exe, and correctly set the rpath on the exe to load the so. Let me know if that works for you. Fix here: d45a071