Missing rpaths in libinterfaces-samba4.so and libserver-role-samba4.so

Zen illiminable at gmail.com
Wed Dec 21 00:28:00 UTC 2016

I came across a problem where these two libraries are missing the RPATH
entry in the ELF header.

For context I'm building essentially from this ebuild -
and applying all the python disable patches in the referenced tgz plus
using --disable-python and --bundled-libraries=talloc,tevent,tdb,lbd and

The symptom is that when I run lddtree to verify dependencies private
libraries don't resolve... eg...

$ lddtree -R /build/samus /usr/lib64/samba/libinterfaces-samba4.so

/build/samus/usr/lib64/samba/libinterfaces-samba4.so (interpreter => None)

   libpthread.so.0 => /build/samus/lib64/libpthread.so.0

       ld-linux-x86-64.so.2 => /build/samus/lib64/ld-linux-x86-64.so.2

   libsamba-debug-samba4.so => None

   libtalloc.so.2 => None

   libbsd.so.0 => /build/samus/usr/lib64/libbsd.so.0
   libc.so.6 => /build/samus/lib64/libc.so.6

And readelf also shows that the RPATH entry is missing on these 2 libraries.

After some discovering that needs_private_lib() in
buildtools/wafsamba/samba_utils.py was returning false for these 2 libs I
further discovered this piece of code...

    if bld.env.standalone_ctdb:
        # If a combined build is implemented, CTDB will want to
        # build against samba-util rather than samba-util-core.
        # Similarly, other Samba subsystems expect samba-util.  So,
        # for a standalone build, just define a fake samba-util
        # subsystem that pulls in samba-util-core.

Basically what happens is that the dependency of these 2 libraries on
samba-util (which does successfully report that it needs private libs and
gets a correct RPATH) gets replaced by this fake version and when
needs_private_libs() checks if this has the private_library=True attribute
it returns false. Even though samba-util-core does depend on private

The workaround I found is to explicitly add a dep from these 2 libs to
samba-debug. I've attached example patches for that. Though it seems a
deeper fix would need to somehow allow those deps to propagate up through a
-------------- next part --------------
A non-text attachment was scrubbed...
Name: interfaces_missing_dep.patch
Type: text/x-patch
Size: 307 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161220/fdd423c3/interfaces_missing_dep.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: server_role_missing_dep.patch
Type: text/x-patch
Size: 409 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161220/fdd423c3/server_role_missing_dep.bin>

More information about the samba-technical mailing list