Bug 6269 - ldb (v4-0-test) cannot not link against tevent + fix
ldb (v4-0-test) cannot not link against tevent + fix
Status: RESOLVED FIXED
Product: Samba 4.0
Classification: Unclassified
Component: Build
unspecified
All Linux
: P3 normal
: ---
Assigned To: Jelmer Vernooij
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-04-18 00:52 UTC by Eric Sandall
Modified: 2009-06-18 03:45 UTC (History)
0 users

See Also:


Attachments
Patch for ldb to link against both tevent and talloc (506 bytes, patch)
2009-04-18 00:54 UTC, Eric Sandall
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Sandall 2009-04-18 00:52:55 UTC
I'm having issues compiling ldb (from samba git v4-0-test branch).

I have all of the sources checked out from v4-0-test branch, but I also
have tevent, tdb, and talloc installed to under /usr. After running
`NOCONFIGURE="x" autogen.sh && ./configure && make` in source4/lib/ldb,
I see:
...
Compiling tools/cmdline.c
gcc -o bin/ldbadd tools/ldbadd.o tools/cmdline.o -z combreloc -s
-Wl,-O1  -Llib -lldb -lpopt -ltalloc -ltdb  -llber -lldap -ldl
-Wl,-export-dynamic
lib/libldb.so: undefined reference to `_tevent_add_timer'
lib/libldb.so: undefined reference to `tevent_loop_once'
lib/libldb.so: undefined reference to `tevent_context_init'
collect2: ld returned 1 exit status
make: *** [bin/ldbadd] Error 1

Not sure if ldb is trying to use the tevent (and tdb and talloc) from
the git checkout or the system, but I have them available in the system
as well:
$ for lib in tevent talloc tdb; do pkg-config --libs $lib; done
-ltevent -ltalloc  
-ltalloc  
-ltdb

I noticed -ltevent is not in there, so I checked config.log and see:
...
configure:22432: checking tevent.h usability
configure:22449: gcc -c  -I./../../../lib/replace -Wall -Wshadow
-Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align
-Wwrite-strings  conftest.c >&5 configure:22456: $? = 0
configure:22470: result: yes configure:22474: checking tevent.h presence
configure:22489: gcc -E  conftest.c
configure:22496: $? = 0
configure:22510: result: yes
configure:22538: checking for tevent.h
configure:22545: result: yes
configure:22550: checking for tevent_context_init in -ltevent
configure:22585: gcc -o conftest  -I./../../../lib/replace -Wall
-Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual -Wcast-align
-Wwrite-strings   conftest.c -ltevent   >&5 conftest.c:193: warning:
function declaration isn't a prototype conftest.c:196: warning:
function declaration isn't a
prototype /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../libtevent.a(tevent.o):
In function `tevent_context_init_byname': tevent.c:(.text+0x2ce):
undefined reference to `_talloc_zero' tevent.c:(.text+0x2e6): undefined
reference to `_talloc_set_destructor' tevent.c:(.text+0x2f9): undefined
reference to
`talloc_free' /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../libtevent.a(tevent.o):
In function `tevent_common_context_destructor': tevent.c:(.text+0x391):
undefined reference to
`talloc_free' /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../libtevent.a(tevent.o):
In function `tevent_backend_list': tevent.c:(.text+0x52b): undefined
reference to
`_talloc_steal' /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../libtevent.a(tevent.o):
In function `tevent_set_default_backend': tevent.c:(.text+0x55a):
undefined reference to `talloc_free' tevent.c:(.text+0x55f): undefined
reference to `talloc_autofree_context' tevent.c:(.text+0x56f):
undefined reference to
`talloc_strdup' /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../libtevent.a(tevent.o):
In function `tevent_register_backend': tevent.c:(.text+0x5d1):
undefined reference to `talloc_autofree_context'
tevent.c:(.text+0x5eb): undefined reference to
`talloc_named_const' /usr/lib/gcc/i686-pc-linux-gnu/4.3.3/../../../libtevent.a(tevent_util.o):
In function `ev_str_list_add': tevent_util.c:(.text+0xfe): undefined
reference to `_talloc_realloc_array' tevent_util.c:(.text+0x12c):
undefined reference to `talloc_strdup'
...
and many more

This seems to be from external/libevents.m4 not also using -ltalloc for
checking for tevent support.

Under external/ I see M4 files for libevents, libtalloc, libpopt,
libtdb, and pkg. All of these seem to work, *except* for libevents,
though I don't see any differences which might cause this, and
configure is trying to find libevent, it's just failing as noted in
config.log.

I'm trying to package up tdb, talloc, tevent, ldb, and samba4 for
libmapi, but am being stopped by ldb.
Comment 1 Eric Sandall 2009-04-18 00:54:11 UTC
Created attachment 4072 [details]
Patch for ldb to link against both tevent and talloc

When linking against tevent you also need to link against talloc. This patch fixes external/libevent.m4 to do so.
Comment 2 Matthias Dieter Wallnöfer 2009-06-18 03:45:34 UTC
Fixed