3 ms·
You can link with the -rpath flag to hardcode an RPATH into the executable, which is essentially an LD_LIBRARY_PATH specified by the executable itself. It can
by ninkendo 5y ago
You can link with the -rpath flag to hardcode an RPATH into the executable, which is essentially an LD_LIBRARY_PATH specified by the executable itself. It can be a relative path too, if you want to put the binary and its required .so’s in the same prefix.
But yeah, this isn’t common to do in the Linux world, unfortunately, because it’s expected that binaries and libraries live in distinct places on the filesystem, rather than bundling them together into an app bundle like on macOS.
- AnIdiotOnTheNet 5y agoYeah, and thanks to Nix you can use PatchELF[0] to change the rpath on a binary too. Point being that for users it is not a straight-forward process to make a Linux application portable. Thanks to Linux Desktop's lackadaisical approach to userspace ABI compatibility it isn't necessarily that easy for developers either. [0] https://github.com/NixOS/patchelf https://github.com/NixOS/patchelf