GNOME Bugzilla – Bug 388789
Subtle bug in autotools checks for iconv
Last modified: 2013-09-13 00:50:11 UTC
I'm guessing I'm the only one in the universe with a system weird enough to trigger this build bug: configure.in does three things in regards to iconv: 1) Check for any special --with-libiconv flag, setting $ICONV_CFLAGS and $ICONV_LIBS if found 2) Check if a program can *link* (which implies compile as well, I guess) against -liconv, adding -liconv to $ICONV_LIBS if so 3) Checks to see if a simple program can compile, link, AND run with the above determined ICONV_CFLAGS and ICONV_LIBS I think the logic from 2->3 is buggy; -liconv should only be added to ICONV_LIBS if a program can compile, link, *and run* against -liconv. The patch to fix this is trivial; I'll attach it in a minute. With the patch (and a similar one for evolution-data-server; see bug 388788), everything builds and functions well for me.
Created attachment 78821 [details] [review] Change AC_TRY_LINK to AC_TRY_RUN for step 2
Patch committed to Subversion trunk, revision 33323. Thanks Elijah!
Any chance we could also get this on the gnome-2-18 branch?
Sure thing. I'll get bug #388788, too. Committed to gnome-2-18 branch (revision 33383).
Thanks!
*** Bug 428375 has been marked as a duplicate of this bug. ***
copying Eric's comment from bug 428375: While trying to track down yet another use-before-initialize bug in evo, I decided to update to evolution-data-server 1.10.1 hoping it was already fixed. However, that version fails at configure in the iconv test. The code does: AC_TRY_RUN([ #include <iconv.h> int main (int argc, char **argv) { iconv_t cd; cd = iconv_open ("UTF-8", "ISO-8859-1"); } ], ac_cv_libiconv=yes, ac_cv_libiconv=no, ac_cv_libiconv=no) Checking the return code of a program which doesn't bother returning any value from main() gets you all the results you expect. Of course, doing a TRY_RUN for just checking which library iconv_open() is in is dubious anyway.
Created attachment 86201 [details] [review] Trivial fix to the bug in the previous patch pointed out by Eric
Thanks. Also added "#include <stdlib.h>" to the test program to make sure it plays nicely with -Werror-implicit-function-declaration. Committed to trunk (revision #33420) and gnome-2-18 branch (revision #33421).
*** Bug 428399 has been marked as a duplicate of this bug. ***