4 ms·
Because I want my program to run on other people's computers.
by alexvitkov 1y ago
Because I want my program to run on other people's computers.
- tempay 1y agoI think the question isn’t why statically link but rather why bother with .a files and instead use the shared libraries all the time (even if only to build a statically linked executable).
- alexvitkov 1y agoYeah, I misunderstood the question. Although if you could statically link .so/.dlls and have it work reliably, it would still be a great convenience, as some libraries are really hard to build statically without rewriting half their build system.
- o11c 1y agoThen just use an rpath with `${ORIGIN}` and ship your .so files along with your binary. The only time where you shouldn't do this is if your executable requires setuid or similar permission bits, but those generally can only reasonably be shipped through distro repos.