Plugins: proper way to change ld.so search path for a single binary
[ I'm not subscribed, please send me CCs ]
I package modular syslog, and as the name implies, it uses
modules for it's input and output methods. These modules are
dynamic libraries, but since they are for exclusive use by
msyslog, I'd rather have them in /lib/msyslog than in /lib,
where I currently keep them.
Syslogd uses dlopen() to load the modules, thus ld.so has to
find the library for syslogd. If I move the modules I have to
tell ld.so where to find them, but I don't know how exactly. I
know of the following methods:
o Changing /etc/ld.so.conf
I don't like this one, since there is no script like
update-inetd to do it, and thus a couple of packages edit it
directly, which is IMHO a mess.
o Running ldconfig -n /lib/msyslog
For some reason this did not work here, even though it
should if I understand ldconfig(8) right.
o Linking syslogd with -rpath /lib/msyslog
This is pretty elegant, and it is not really hardcoding in
anything, since it can be overridden by whatever the admin
sets in /etc/ld.so.conf. However I remember reading in some
debian manual that one should not use -rpath, unfortunately
I can't find it again. Is it okay to use -rpath or not?
o Use a wrapper script that sets LD_LIBRARY_PATH
A bit much hassle just to tell ld.so where to dig for the
libs, but else it seems ok.
Can anybody please tell me what I should do? I would use -rpath,
but as I said I think there was some document telling not to do
so for whatever reason.
The light at the end of the tunnel is the headlight of an approaching