missing rpath [was: building bundled talloc/tevent/tdb libs out of main samba sources]
Michael Tokarev
mjt at tls.msk.ru
Wed Nov 27 06:04:52 UTC 2024
27.11.2024 08:26, Andrew Bartlett via samba-technical wrote:
> On Wed, 2024-11-27 at 08:12 +0300, Michael Tokarev via samba-technical
...>> But my attempt were unsuccessful so far, as it turned out.
>>
>> Once I arrange to build all 3 libs out of samba, the build system
>> suddenly stops embedding rpath-private into all binaries, so the
>> resulting thing, while having the same set of files, actually does
>> not work, - not finding samba private libraries in libdir/samba.
>> I'm investigating it now, - but again, the build system is just too
>> complex and very difficult to debug, so it might take some time.
>> It's something I didn't expect at all, as all other changes are
>> rather simple.
>
> That is why I'm suggesting looking at what I did for ldb, and trying to
> make that more general, because we worked on some of those details.
This issue at hand has nothing to do with the actual way to build
libtdb &Co. It's just a consequence of too complex build system.
Here's what I've found, using param.cpython as a starting point:
$ fgrep param.cpython build.* | grep rpath
build.bad:runner [..samba/samba3/param.cpython-312-x86_64-linux-gnu.so..
build.good:runner [..samba/param.cpython-312-x86_64-linux-gnu.so..
build.good:runner [..samba/samba3/param.cpython-312-x86_64-linux-gnu.so..
as we can see, param.cpython-312.. is missing in the 'bad' case, -
it is built without private rpath.
Looking at the definition of param.cpython, in source3/samba/wscript_build:
bld.SAMBA3_SUBSYSTEM(pyparam_util,
source='pyparam_util.c',
deps='%s samba-hostconfig %s' % (libpython, pytalloc_util),
pyext=True,
enabled=bld.PYTHON_BUILD_IS_ENABLED()
)
so only samba-hostconfig is referenced as a dependency from the list
of samba libs. However:
$ patchelf --print-needed python3-samba/usr/lib/python3/dist-packages/samba/param.cpython-312-x86_64-linux-gnu.so
libsamba-hostconfig.so.0
libserver-role-private-samba.so.0
libsamba-util.so.0
libsamba-debug-private-samba.so.0
libtalloc.so.2
libpytalloc-util.cpython-312-x86-64-linux-gnu.so.2
libc.so.6
so besides samba-hostconfig, it also needs stuff - DIRECTLY - from
a lot of other samba libraries, including some private ones. But
none of these are specified as deps.
And in wafsamba code which decides when to embed rpath, we see it
looks for deps and if none are in private, skips adding it.
Now,
$ fgrep -c Wl,-rpath,/usr/lib/x86_64-linux-gnu/samba build.*
build.bad:466
build.good:491
so there are 25 such libs with missing deps JUST IN THIS CASE.
I guess all of them were receiving one or more private libs
indirectly - probably though pytalloc-util or something.
Finding and patching all 25 cases is not realistic. But I'll
try to see what's the root of the tree here.
FWIW, I already submitted another similar fix for a missing
dependency, - it's in my (largeish) MR which is stalled due
to another issue somewhere in wafsamba/wscripts which I'm
having hard time to debug - probably I should drop that one
change from the MR and keep it debian-only for now.
Thanks,
/mjt
More information about the samba-technical
mailing list