On Wed, Aug 04, 2010 at 08:35:30PM +0100, Timo Sirainen wrote:
Linking fails with the --as-needed flag: [...] libtool: link: i686-pc-linux-gnu-gcc -O2 -march=prescott -pipe -fomit-frame-pointer -mno-tls-direct-seg-refs -Wl,-O1 -Wl,--as-needed -o .libs/doveadm doveadm-mail.o doveadm-mail-altmove.o doveadm-mail-expunge.o doveadm-mail-fetch.o doveadm-mail-iter.o doveadm-mail-mailbox.o doveadm-mail-mailbox-status.o doveadm-mail-list-iter.o doveadm-mail-search.o doveadm-print.o doveadm-settings.o doveadm-util.o doveadm.o doveadm-auth.o doveadm-director.o doveadm-dump.o doveadm-dump-index.o doveadm-dump-log.o doveadm-dump-mailboxlog.o doveadm-dump-thread.o doveadm-kick.o doveadm-log.o doveadm-master.o doveadm-mail-server.o doveadm-mutf7.o doveadm-penalty.o doveadm-print-flow.o doveadm-print-pager.o doveadm-print-tab.o doveadm-print-table.o doveadm-pw.o doveadm-who.o server-connection.o -Wl,--export-dynamic ../../src/lib-storage/.libs/libdovecot-storage.so -lcrypt -lpam ../auth/libpassword.a ../lib-ntlm/libntlm.a ../lib-otp/libotp.a ../../src/lib-dovecot/.libs/libdovecot.so -ldl -lrt -Wl,-rpath -Wl,/usr/lib/dovecot ../auth/libpassword.a(mycrypt.o): In function `mycrypt': mycrypt.c:(.text+0x7): undefined reference to `crypt' collect2: ld returned 1 exit status make[3]: *** [doveadm] Error 1 Looks like the linkng order is wrong. I believe libcrypt and libpam should be after the static archives: --- src/doveadm/Makefile.in.orig 2010-08-04 17:34:24.000000000 +0000 +++ src/doveadm/Makefile.in 2010-08-05 07:38:30.000000000 +0000 @@ -293,8 +293,9 @@ $(unused_objects) doveadm_LDADD = \ - $(libs) $(AUTH_LIBS) \ + $(libs) \ $(cmd_pw_libs) \ + $(AUTH_LIBS) \ $(LIBDOVECOT) \ $(MODULE_LIBS) --- src/doveadm/Makefile.am.orig 2010-07-30 14:04:48.000000000 +0000 +++ src/doveadm/Makefile.am 2010-08-05 07:38:30.000000000 +0000 @@ -38,8 +38,9 @@ $(unused_objects) doveadm_LDADD = \ - $(libs) $(AUTH_LIBS) \ + $(libs) \ $(cmd_pw_libs) \ + $(AUTH_LIBS) \ $(LIBDOVECOT) \ $(MODULE_LIBS) doveadm_DEPENDENCIES = \ -- Eray