Re: s6-svscan can't find shared libraries

From: Laurent Bercot <ska-skaware_at_skarnet.org>
Date: Tue, 03 Dec 2019 23:51:34 +0000

>/opt/local/bin/s6-svscan: error while loading shared libraries: libs6.so.2.9: cannot open shared object file: No such file or directory
>Is this because the '-rpath' linker option is not used at compile time
>to add the library directory to the runtime library search path?

You could say that - or, more precisely, it's because your system isn't
configured to search for shared libraries in /opt/local/lib. It is on
purpose that s6 (or other skarnet.org software) does not automatically
add rpaths at build time: rpaths prevent run-time relocations, which can
be useful in a number of situations. Adding a rpath is hardcoding
policy,
and by default, software should not hardcode policy.

There is no reason for you not to want to modify /etc/ld.so.conf. It's
the same thing as refusing to add /opt/local/bin to your PATH and then
complaining that the binaries are harder to find. Well, yeah, there are
conventional directories to host binaries and shared libraries, and the
convention exists for a reason; if you want to customize, you're free to
do so, but then you should use the adequate mechanism for customization,
which is adjusting your paths.
(Note that a number of s6 executables *expect* to find other s6
executables in their PATH. If /opt/local/bin is not in your default
PATH,
and you have not used the --enable-absolute-paths configure option,
some s6 executables may not work correctly.)

But there's another solution: as a software author, I shouldn't hardcode
policy, but as an admin, *you* absolutely can! So, if that is your
preference, you can add the rpath yourself at build time:

env LDFLAGS=-Wl,-rpath,/opt/local/lib ./configure ....

Hope this helps,

--
Laurent
Received on Tue Dec 03 2019 - 23:51:34 UTC

This archive was generated by hypermail 2.3.0 : Sun May 09 2021 - 19:38:49 UTC