Bug 11540 - standalone ldb build still links against system libraries
standalone ldb build still links against system libraries
Status: NEW
Product: Samba 4.1 and newer
Classification: Unclassified
All All
: P5 normal
: ---
Assigned To: Andrew Bartlett
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2015-10-02 19:19 UTC by Jakub Hrozek
Modified: 2015-10-07 08:05 UTC (History)
2 users (show)

See Also:

Patches (talloc, tevent and ldb) for master (3.16 KB, patch)
2015-10-03 09:32 UTC, Stefan Metzmacher
metze: review? (asn)

Note You need to log in before you can comment on or make changes to this bug.
Description Jakub Hrozek 2015-10-02 19:19:19 UTC
I'd like to build standalone LDB with everything in-tree, but this is not possible with only using the configure script from lib/ldb.

I can reproduce with a clean samba checkout with:
 * git clone samba
 * cd lib/ldb
 * ./configure --bundled-libraries=all
 * make test

I would expect the tests to run and pass, then. Instead, I get:
WAF_MAKE=1 PATH=buildtools/bin:../../buildtools/bin:$PATH waf test 
ldbadd: error while loading shared libraries: libldb-cmdline.so: cannot open shared object file: No such file or directory
testsuite returned 1
Makefile:15: recipe for target 'test' failed
make: *** [test] Error 1

And indeed:
ldd ./bin/ldbadd
        linux-vdso.so.1 (0x00007ffdbb7f2000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f8ab362b000)
        libldb.so.1 => /lib64/libldb.so.1 (0x00007f8ab33fd000)
        libldb-cmdline.so => not found
        libtdb.so.1 => /lib64/libtdb.so.1 (0x00007f8ab31e7000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f8ab2fb1000)
        libattr.so.1 => /lib64/libattr.so.1 (0x00007f8ab2dab000)
        libtevent.so.0 => /lib64/libtevent.so.0 (0x00007f8ab2b9d000)
        libtalloc.so.2 => /lib64/libtalloc.so.2 (0x00007f8ab2989000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f8ab2784000)
        libpopt.so.0 => /lib64/libpopt.so.0 (0x00007f8ab2577000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f8ab21b7000)
        /lib64/ld-linux-x86-64.so.2 (0x00005616cf24e000)
        libfreebl3.so => /lib64/libfreebl3.so (0x00007f8ab1f39000)

So some dependencies are not found, others are found, but they are system libraries. I'd expect bundled libraries to be used instead since I specified --bundled-libraries=all.

btw everything seems to work OK if I do ./configure.developer  --bundled-libraries=all from the Samba root..
Comment 1 Stefan Metzmacher 2015-10-03 09:31:35 UTC
(In reply to Jakub Hrozek from comment #0)

Can you try:

./configure --bundled-libraries=all
make -j
make test

It seems that 'make test' doesn't imply building for some reason.
Comment 2 Stefan Metzmacher 2015-10-03 09:32:28 UTC
Created attachment 11475 [details]
Patches (talloc, tevent and ldb) for master
Comment 3 Jakub Hrozek 2015-10-05 15:49:38 UTC
The patches look OK to me and should be accepted IMO, but they don't address the issue for me, sorry. Even after applying them and running:

./configure --bundled-libraries=all
make clean
make test

I still see ./bin/ldbadd linked against the system libldb, not the in-tree one. ldd still shows the same as in the opening comment..
Comment 4 Jakub Hrozek 2015-10-05 15:50:56 UTC
btw this only happens if I run ./configure from $samba_git/lib/ldb, when I run configure from $samba_git, then everything works fine...it's just then running make and make test gets a bit annoying as sometimes too much is executed..
Comment 5 Andreas Schneider 2015-10-05 15:57:57 UTC
Metze, the difference to the Samba build is, that Samba build with rpath set so you can execute the binaries in the source directory. We do not do that in the ldb standalone build, this also shows the ldd from the initial description.
Comment 6 Stefan Metzmacher 2015-10-05 23:00:10 UTC
(In reply to Andreas Schneider from comment #5)

Try ./configure --bundled-libraries=ALL instead of
./configure --bundled-libraries=all

For me

./configure --bundled-libraries=ALL && make clean && TDB_NO_FSYNC=1 make test

results in:

ldd bin/ldbadd
        linux-vdso.so.1 =>  (0x00007fff1a174000)
        libldb.so.1 => /build/samba/lib/ldb/bin/shared/libldb.so.1 (0x00007fa7a6fd1000)
        libldb-cmdline.so => /build/samba/lib/ldb/bin/shared/private/libldb-cmdline.so (0x00007fa7a6fc9000)
        libtalloc.so.2 => /build/samba/lib/ldb/bin/shared/private/libtalloc.so.2 (0x00007fa7a6fbe000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fa7a6a25000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fa7a6807000)
        libtevent.so.0 => /build/samba/lib/ldb/bin/shared/private/libtevent.so.0 (0x00007fa7a6f83000)
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fa7a6603000)
        libpopt-ldb.so => /build/samba/lib/ldb/bin/shared/private/libpopt-ldb.so (0x00007fa7a6f77000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fa7a6dea000)
Comment 7 Andreas Schneider 2015-10-07 08:05:40 UTC
Why does:

./configure '--bundled-libraries=!ldb'

Also fix it? It builds internal talloc and tevent ...