News for hackers. Stuff that matters.
Re:The abysmal state of GNU/Linux and a case against shared ... by o11c on Monday October 14, 2024 @08:38PM (#41843755)
> Feel free to statically link it

Actually, please don't. There's a nontrivial chance that you'll ship a copy with bugs that somebody wants to fix.

Instead, to get ALL the advantages of static linking with none of the downsides, what you should do is:

* dynamically link, shipping a copy of the library alongside the binary

This allows the user to find a newer build of the same-version library. It's also much less likely to be illegal (not that anybody cares about laws).

* use rpath to load the library

Remember: rpath is NOT a security hole in general. The only time that can happen is if it is both a privileged program (setuid, setcap, etc.) and it contains a non-owner-writable path, neither of which is likely to happen for the kind of software people complain about shipping.

* do not use dlopen, please

`dlopen` works well for plugins, but terribly for actually-needed dependencies.

There are no comments on this comment yet.