KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
861 stars 225 forks source link

CLI doesn't work out of the box on Linux due to missing rpath in binaries #796

Closed Calinou closed 9 months ago

Calinou commented 10 months ago

OS: Fedora 38 x86_64 KTX Software version: 4.2.1 and 4.3.0-alpha3

On Linux, compiled KTX Software binaries should have their rpath set to ../lib, so that they detect libraries out of the box:

$ ./ktx
./ktx: error while loading shared libraries: libktx.so.4: cannot open shared object file: No such file or directory

You can work around this issue by using LD_LIBRARY_PATH=../lib ./ktx from the bin folder or LD_LIBRARY_PATH=lib bin/ktx from the root folder, but this isn't obvious.

If setting rpath isn't possible, a launcher script that sets LD_LIBRARY_PATH automatically (relative to the directory the binary is in) can be provided in the official distribution, but rpath is the preferred approach.

MarkCallow commented 10 months ago

Are you talking about running from within the build tree or running the installed software? If the latter, when did Linux remove/usr/local/lib from the search path for shared libraries?

Calinou commented 10 months ago

Are you talking about running from within the build tree or running the installed software? If the latter, when did Linux remove/usr/local/lib from the search path for shared libraries?

I'm running the .tar.bz2 download from https://github.com/KhronosGroup/KTX-Software/releases/tag/v4.3.0-alpha3, extracted to a local folder (so I don't need sudo to install it). I'd prefer not using the distro packages as they require root to be installed and can complicate system upgrades.