Hi,

Compiling on FreeBSD 10.1 gives linker errors when linking
test-message-snippet. The underlying problem is that libiconv appears on the
actual linker line after libcharset.a, which leads to unresolved libiconv
symbols.

This build process worked fine with 2.2.15. The patch below to
src/lib-charset/Makefile.in resolves the problem for me and seems broadly
correct. libcharset.a does depend on libiconv so it should probably be
declared that way. There is probably a more correct way to make the
patch to Makefile.am, but I don't really use automake.

Hopefully helpful to someone.

Jan Mikkelsen.


Patch:

--- dovecot-2.2.16/src/lib-charset/Makefile.in  2015-03-13 02:41:16.000000000 
+1100
+++ dovecot-2.2.16.new/src/lib-charset/Makefile.in      2015-03-21 
13:58:21.951293274 +1100
@@ -92,7 +92,7 @@
 CONFIG_CLEAN_FILES =
 CONFIG_CLEAN_VPATH_FILES =
 LTLIBRARIES = $(noinst_LTLIBRARIES)
-libcharset_la_LIBADD =
+libcharset_la_LIBADD = $(LTLIBICONV)
 am_libcharset_la_OBJECTS = charset-iconv.lo charset-utf8.lo
 libcharset_la_OBJECTS = $(am_libcharset_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)

Error messages:

libtool: link: cc -std=gnu99 -I/usr/local/include -Wall -W -Wmissing-prototypes 
-Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 
-Wbad-function-cast -Wno-duplicate-decl-specifier -Wstrict-aliasing=2 
-Wl,--as-needed -o test-message-snippet test-message-snippet.o 
.libs/message-snippet.o .libs/mail-html2text.o .libs/message-decoder.o 
.libs/quoted-printable.o .libs/rfc822-parser.o .libs/rfc2231-parser.o 
/usr/local/lib/libiconv.so -Wl,-rpath -Wl,/usr/local/lib .libs/message-parser.o 
.libs/message-header-parser.o .libs/message-header-decode.o 
.libs/message-size.o  -L/usr/local/lib ../lib-charset/.libs/libcharset.a 
../lib-test/.libs/libtest.a ../lib/.libs/liblib.a 
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_begin':
charset-iconv.c:(.text+0x49): undefined reference to `libiconv_open'
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_end':
charset-iconv.c:(.text+0x151): undefined reference to `libiconv_close'
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_reset':
charset-iconv.c:(.text+0x211): undefined reference to `libiconv'
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_try':
charset-iconv.c:(.text+0x425): undefined reference to `libiconv'
cc: error: linker command failed with exit code 1 (use -v to see invocation)
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_begin':
charset-iconv.c:(.text+0x49): undefined reference to `libiconv_open'
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_end':
charset-iconv.c:(.text+0x151): undefined reference to `libiconv_close'
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_reset':
charset-iconv.c:(.text+0x211): undefined reference to `libiconv'
../lib-charset/.libs/libcharset.a(charset-iconv.o): In function 
`charset_to_utf8_try':
charset-iconv.c:(.text+0x425): undefined reference to `libiconv'

Reply via email to