Dovecot fails to compile --with-cdb (and attempted fix)

Timo Sirainen tss at iki.fi
Thu Mar 12 13:43:47 UTC 2015


On 10 Mar 2015, at 16:24, Jeffrey 'jf' Lim <jfs.world at gmail.com> wrote:
> 
> On Tue, Mar 10, 2015 at 2:22 AM, Jeffrey 'jf' Lim <jfs.world at gmail.com>
> wrote:
> 
>> On Tue, Mar 10, 2015 at 2:15 AM, Jeffrey 'jf' Lim <jfs.world at gmail.com>
>> wrote:
>> 
>>> Dovecot version: 2.2.15
>>> Tinycdb: 0.78
>>> 
>>> I'm attempting to compile dovecot --with-cdb, but keep getting into a
>>> problem with cdb:
>>> ========================
>>> libtool: link: gcc -std=gnu99 -g -O2 -Wall -W -Wmissing-prototypes
>>> -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2
>>> -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2
>>> -Wl,--as-needed -o .libs/anvil main.o anvil-connection.o anvil-settings.o
>>> connect-limit.o penalty.o -Wl,--export-dynamic
>>> ../../src/lib-dovecot/.libs/libdovecot.so -ldl -lrt -Wl,-rpath
>>> -Wl,/usr/local/lib/dovecot
>>> ../../src/lib-dovecot/.libs/libdovecot.so: undefined reference to
>>> `cdb_read'
>>> ../../src/lib-dovecot/.libs/libdovecot.so: undefined reference to
>>> `cdb_find'
>>> ../../src/lib-dovecot/.libs/libdovecot.so: undefined reference to
>>> `cdb_free'
>>> ../../src/lib-dovecot/.libs/libdovecot.so: undefined reference to
>>> `cdb_init'
>>> collect2: ld returned 1 exit status
>>> make[3]: *** [anvil] Error 1
>>> make[3]: Leaving directory `/home/jf/dovecot-2.2.15/src/anvil'
>>> ==========================
>>> 
>>> After some troubleshooting, I've finally managed to get dovecot to
>>> compile, albeit with a hack:
>>> 
>>> --- src/lib-dovecot/Makefile.old    2015-03-09 17:36:15.690179802 +0000
>>> +++ src/lib-dovecot/Makefile    2015-03-09 18:01:43.075719700 +0000
>>> @@ -230,7 +230,7 @@
>>> LIBDOVECOT_STORAGE_DEPS = $(top_builddir)/src/lib-storage/
>>> libdovecot-storage.la $(top_builddir)/src/lib-imap-storage/
>>> libimap-storage.la
>>> LIBICONV =
>>> LIBOBJS =
>>> -LIBS = -lrt
>>> +LIBS = -lrt -lcdb
>>> LIBTOOL = $(SHELL) $(top_builddir)/libtool
>>> LIBWRAP_LIBS =
>>> LINKED_STORAGE_LDADD =
>>> 
>>> This isn't the best fix, admittedly (I wish I were more familiar with
>>> autotools), but I'll say that the configure process isn't right yet for
>>> cdb. Can anybody produce a better fix? Would love to learn more.
>>> 
>>> 
>> ok, well I guess that "fixed" the compilation, but as I've just found out,
>> it does *not* link in libcdb (I've got libcdb in /usr/local/lib) properly!
>> Has anybody tried to compile dovecot with cdb support?
>> 
> 
> For anybody following: sorry, my bad. It turns out I hadn't set CPPFLAGS
> and LDFLAGS during the configure to use /usr/local/{include,lib}. When
> that's done, this works (in the sense that libdovecot.so is now linked with
> libcdb!).
> 
> I'm not so sure that this is the best place to link libcdb in, though, but
> for an expedient fix, it works.... Would appreciate somebody more familiar
> with the code weighing in on this one.

Well, it was never supposed to be linked to anything except the dict binary, allowing it to be used via the dict proxy. Changed: http://hg.dovecot.org/dovecot-2.2/rev/16ff063e3588



More information about the dovecot mailing list