Include the full library path in shared-library, rather than the soname only
@gcampagna
Submitted by Giovanni Campagna Link to original bug (#640446)
Description
Having only the soname means that the version loaded is from the path in ld.so and binary rpath, which may be different from the path the actual library is installed into. For example with python, unless you rebuild it to include your custom libdir, you have no control on library search paths.
In particular:
- If the library uses unversioned sonames (like Gtk and GLib), an incompatible version may be loaded, causing runtime failures.
- If the libdir is not added to ld.so/rpath, module importing will just fail.
Real world use case: GNOME Shell uses libgnome-bluetooth-applet.so, which is installed into $(libdir)/gnome-bluetooth/. It cannot modify the RPATH for dlopened modules (it is in mutter, not libgnome-shell.so), so it adds a fake DT_NEEDED to get it always loaded - but this fails with --as-needed (which is the default in some distributions), because it does not use any symbol from libgnome-bluetooth-applet in compiled code. Bug 639324.