mockingbirdnest / Principia

𝑛-Body and Extended Body Gravitation for Kerbal Space Program
MIT License
746 stars 67 forks source link

Unable to find principia.so; strace shows the game searching in tons of weird locations, but never in GameData/principia/Linux64 #4004

Closed Dupiter-AU closed 1 month ago

Dupiter-AU commented 1 month ago

strace.txt KSP.log Player.log

Fresh KSP 1.12.5 install, no other mods besides principia (latest ver). Up to date OS. Issue persists even with an OS reinstall. libc++ and libc++abi are installed (ver 17.0.6-1). Issue persists no matter if the game is launched through steam as a non-steam game or directly from the executable.

It appears that principia searches for the .so file in a multitude of irrelevant directories. Player.log shows only a few, and placing a copy of the principia folder in those directories doesn't make a difference

Obviously issue does not persist when the game is launched using Proton (ie the windows version), however the proton version of the game has severe VRAM management issues and frequent crashes.

Operating System: Arch Linux KDE Plasma Version: 6.0.4 KDE Frameworks Version: 6.2.0 Qt Version: 6.7.0 Kernel Version: 6.8.9-arch1-2 (64-bit) Graphics Platform: X11 Processors: 16 × AMD Ryzen 7 5700X 8-Core Processor Memory: 31.3 GiB of RAM Graphics Processor: NVIDIA GeForce RTX 2060 SUPER/PCIe/SSE2 Manufacturer: Micro-Star International Co., Ltd. Product Name: MS-7C56 System Version: 2.0

Nazfib commented 1 month ago

That looks like one of the native dependencies can't be found. I noticed that, starting with Καραθεοδωρή, Principia now also requires LLVM's version of libunwind (besides libc++ and libc++abi); specifically, libunwind.so.1 version 17 or higher. On my Fedora system, the package is called llvm-libunwind.

pleroy commented 1 month ago

Agreed, these messages seem to indicate that it has trouble finding some libraries (otherwise why would it look for them in weird places?):

openat(AT_FDCWD, "/home/dupiter/.local/share/Steam/steamapps/common/Kerbal Space Program (Test)/libc++.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/dupiter/.local/share/Steam/steamapps/common/Kerbal Space Program (Test)/libc++abi.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/home/dupiter/.local/share/Steam/steamapps/common/Kerbal Space Program (Test)/libunwind.so.1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

The fix may be as easy as symlinking them in the right place.

Also, it surprises me that it fails to find some of the Squad files, but maybe they don't exist on Linux:

stat("/home/dupiter/.local/share/Steam/steamapps/common/Kerbal Space Program (Test)/GameData/Squad/squadcorefx.ksp", 0x7ffe262e6ec0) = -1 ENOENT (No such file or directory)
lstat("/home/dupiter/.local/share/Steam/steamapps/common/Kerbal Space Program (Test)/GameData/Squad/squadcorefx.ksp", 0x7ffe262e6ec0) = -1 ENOENT (No such file or directory)

At any rate, it's not the first time that people run into trouble with Arch Linux, but then the only distro that we support is Ubuntu, so other than educated guesses, we cannot help you.

pleroy commented 1 month ago

@Nazfib wrote:

I noticed that, starting with Καραθεοδωρή, Principia now also requires LLVM's version of libunwind (besides libc++ and libc++abi); specifically, libunwind.so.1 version 17 or higher.

That's interesting, I had no idea. We "just" upgraded from Clang 8 to Clang 17, but I don't remember adding something that would pull an extra dependency. Anyway, I guess we should mention it in the "failed to load" screen and in the documentation.

Dupiter-AU commented 1 month ago

Yes, symlinking the libc++ and libc++abi .so files to the ksp directory does remove those messages. The llvm version of libunwind isn't in the standard repos (the non-llvm libunwind package is in the repos however). It is on the AUR, albeit with low popularity so if anyone wants to take the plunge they can go ahead, but I prefer not to trust most AUR packages.

I did make another intriguing finding: I had principia Julia lying around so I decided to test it to see if I could boot without llvm-libunwind, and found that it worked, even if the libc++ and libc++abi libraries weren't symlinked (strace still showed the "No such file or directory" message), so it looks like the strace errors are unrelated?

Strange that it would randomly pull an extra dependency like that. It might be a good idea to further investigate principia dependencies so as to have all the needed information on the principia error message.

Dupiter-AU commented 1 month ago

Breaking news: I symlinked libc++.so.1 and libc++abi.so.1 to the ksp directory from /usr/lib, and with the arch repo libunwind installed I symlinked libunwind.so to the ksp directory as libunwind.so.1 and principia (latest) now works.

Would it be possible to add these steps to the documentation for arch users?

pleroy commented 1 month ago

I added a note here.

Dupiter-AU commented 1 month ago

Looks good to me, I'll close this now