Q: RUNPATH missing in libsmbldap.so but not other executables/libraries?

Michael Tokarev mjt at tls.msk.ru
Thu May 19 17:32:22 UTC 2022

13.05.2022 12:35, Michael Tokarev via samba-technical wrote:
> Hi!
> In debian we've got a bugreport about one of the samba libraries missing RUNPATH
> to the private library directory (where libreplace-sambae.so libsmbd-shim-samba4.so
> etc are located.  This one is libsmbldap.so.2.1.0. And indeed, unlike all other
> libs and executables, this one lacks RUNPATH section, while all other binaries
> does have it.
> $ ldd /usr/lib/x86_64-linux-gnu/libsmbldap.so.2.1.0 | grep found
>      libsamba-debug-samba4.so.0 => not found
>      libreplace-samba4.so.0 => not found
>      libsamba-security-samba4.so.0 => not found
>      libsmbd-shim-samba4.so.0 => not found


                     deps='ldap lber samba-util smbconf',

All 4 of these are not marked as "private".

buildtools/wafsamba/samba_utils.py:install_rpath() only list private
libdir if at least one of the dependencies is marked as private.

but since libsmbldap is actually uses symbols from other libraries,
as determined by the linker (all these are listed in NEEDED section),
it seems logical to include these in the dependencies. So after this:

-                    deps='ldap lber samba-util smbconf',
+                    deps='ldap lber samba-util smbconf replace samba-debug samba-security',

it builds fine *and* includes the private library path in the resulting
library, so that ldd etc is actually able to find the above 4 deps

I don't know (yet) about smbd-shim which is also needed by libsmbldap
but which is not a usual library.  But this is enough already to fix
the underlying issue (of binaries being unable to find their dependencies).

The same is true for other libs which are also missing private libs
directory in their RUNPATH:

File: /usr/lib/x86_64-linux-gnu/samba/libads-samba4.so.0
File: /usr/lib/x86_64-linux-gnu/samba/libnet-keytab-samba4.so.0
File: /usr/lib/x86_64-linux-gnu/samba/libsamba-modules-samba4.so.0
File: /usr/lib/x86_64-linux-gnu/samba/libsmbldaphelper-samba4.so.0

adding their corresponding dependencies in wscripts fixes the issue.

Looking at the whole picture, it seems like the dependency problem
in samba is *huge*, there's just a few libs which gets their deps
correctly, vast majority of them are wrong. I don't know if it is
worth fixing this mess, -- at least it should be done by someone
who knows the thing just a bit.

I'm fixing this in debian, but I'm not submitting a patch to samba,
since it's just a waste of my time.



More information about the samba-technical mailing list