/
Bugzilla – Bug 3682
Configure does not detect libiconv under Gentoo FreeBSD
Last modified: 2012-08-15 16:54:29 UTC
Hello ProFTPD-Developers, the Gentoo FreeBSD libc implementation does not support iconv and hence ProFTPD requires the dev-libs/libiconv [1] package when building ProFTPD with nls support. But in Gentoo Bug #354295 comment 5 and later [2] Dmitri Bogomolov reported that the two configure tests are failing to detect libiconv: (..) checking whether libtool supports -dlopen/-dlpreopen... yes checking for bindtextdomain in -lintl... yes checking for iconv_open in -liconv... no checking for iconv_open in -lc... no configure: error: libiconv support, required for NLS, not present -- aborting In [3] you can find the complete log of ./configure. The important lines of both failing tests are: configure:15417: checking for iconv_open in -liconv configure:15452: i686-gentoo-freebsd7.2-gcc -o conftest -O2 -march=i686 -pipe -Wall -L$(top_srcdir)/lib conftest.c -liconv >&5 /var/tmp/portage/net-ftp/proftpd-1.3.4_rc2-r1/temp/ccFM0XZa.o: In function `main': conftest.c:(.text+0x7): undefined reference to `iconv_open' collect2: ld returned 1 exit status configure:15458: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PR_BUILD_OPTS " '--prefix=/usr' '--build=i686-gentoo-freebsd7.2' '--host=i686-gentoo-freebsd7.2' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--localstatedir=/var/run/proftpd' '--sysconfdir=/etc/proftpd' '--disable-facl' '--disable-auth-file' '--disable-cap' '--disable-ident' '--disable-ipv6' '--disable-memcache' '--enable-ncurses' '--enable-nls' '--enable-auth-pam' '--enable-pcre' '--disable-trace' '--disable-shadow' '--disable-autoshadow' '--enable-openssl' '--with-modules=mod_clamav:mod_ldap:mod_sql:mod_sql_passwd:mod_sql_postgres:mod_radius:mod_tls:mod_tls_shmcache:mod_wrap2:mod_wrap2_file:mod_wrap2_sql' 'build_alias=i686-gentoo-freebsd7.2' 'host_alias=i686-gentoo-freebsd7.2' 'CFLAGS=-O2 -march=i686 -pipe' 'LDFLAGS=' 'LIBS='" | #define PR_PLATFORM "FREEBSD7 (FREEBSD7_2)" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR ".libs/" | #define HAVE_GETOPT 1 | #define HAVE_GETOPT_H 1 | #define HAVE_GETOPT_LONG 1 | #define PR_USE_SYSTEM_GETOPT 1 | #define LT_MODULE_EXT ".so" | #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH" | #define LT_DLSEARCH_PATH "/lib:/usr/lib" | #define HAVE_LIBDL 1 | #define HAVE_DLERROR 1 | #define HAVE_LIBDLLOADER 1 | #define error_t int | #define __error_t_defined 1 | #define HAVE_PRELOADED_SYMBOLS 1 | #define HAVE_LIBINTL 1 | #define PR_USE_NLS 1 | /* end confdefs.h. */ | | /* Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char iconv_open (); | int | main () | { | return iconv_open (); | ; | return 0; | } configure:15476: result: no configure:15493: checking for iconv_open in -lc configure:15528: i686-gentoo-freebsd7.2-gcc -o conftest -O2 -march=i686 -pipe -Wall -L$(top_srcdir)/lib conftest.c -lc >&5 /var/tmp/portage/net-ftp/proftpd-1.3.4_rc2-r1/temp/cc86VZ1c.o: In function `main': conftest.c:(.text+0x7): undefined reference to `iconv_open' collect2: ld returned 1 exit status configure:15534: $? = 1 configure: failed program was: | /* confdefs.h. */ | #define PACKAGE_NAME "" | #define PACKAGE_TARNAME "" | #define PACKAGE_VERSION "" | #define PACKAGE_STRING "" | #define PACKAGE_BUGREPORT "" | #define PR_BUILD_OPTS " '--prefix=/usr' '--build=i686-gentoo-freebsd7.2' '--host=i686-gentoo-freebsd7.2' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--localstatedir=/var/run/proftpd' '--sysconfdir=/etc/proftpd' '--disable-facl' '--disable-auth-file' '--disable-cap' '--disable-ident' '--disable-ipv6' '--disable-memcache' '--enable-ncurses' '--enable-nls' '--enable-auth-pam' '--enable-pcre' '--disable-trace' '--disable-shadow' '--disable-autoshadow' '--enable-openssl' '--with-modules=mod_clamav:mod_ldap:mod_sql:mod_sql_passwd:mod_sql_postgres:mod_radius:mod_tls:mod_tls_shmcache:mod_wrap2:mod_wrap2_file:mod_wrap2_sql' 'build_alias=i686-gentoo-freebsd7.2' 'host_alias=i686-gentoo-freebsd7.2' 'CFLAGS=-O2 -march=i686 -pipe' 'LDFLAGS=' 'LIBS='" | #define PR_PLATFORM "FREEBSD7 (FREEBSD7_2)" | #define STDC_HEADERS 1 | #define HAVE_SYS_TYPES_H 1 | #define HAVE_SYS_STAT_H 1 | #define HAVE_STDLIB_H 1 | #define HAVE_STRING_H 1 | #define HAVE_MEMORY_H 1 | #define HAVE_STRINGS_H 1 | #define HAVE_INTTYPES_H 1 | #define HAVE_STDINT_H 1 | #define HAVE_UNISTD_H 1 | #define HAVE_DLFCN_H 1 | #define LT_OBJDIR ".libs/" | #define HAVE_GETOPT 1 | #define HAVE_GETOPT_H 1 | #define HAVE_GETOPT_LONG 1 | #define PR_USE_SYSTEM_GETOPT 1 | #define LT_MODULE_EXT ".so" | #define LT_MODULE_PATH_VAR "LD_LIBRARY_PATH" | #define LT_DLSEARCH_PATH "/lib:/usr/lib" | #define HAVE_LIBDL 1 | #define HAVE_DLERROR 1 | #define HAVE_LIBDLLOADER 1 | #define error_t int | #define __error_t_defined 1 | #define HAVE_PRELOADED_SYMBOLS 1 | #define HAVE_LIBINTL 1 | #define PR_USE_NLS 1 | /* end confdefs.h. */ | | /* Override any GCC internal prototype to avoid an error. | Use char because int might match the return type of a GCC | builtin and then its argument prototype would still apply. */ | #ifdef __cplusplus | extern "C" | #endif | char iconv_open (); | int | main () | { | return iconv_open (); | ; | return 0; | } configure:15552: result: no configure:15563: error: libiconv support, required for NLS, not present -- aborting Dmitri Bogomolov is using dev-libs/libiconv-1.13.1 which installs the following interesting files (whole list with docs and man pages at [4]): /lib /lib/libcharset.so /lib/libcharset.so.1 /lib/libcharset.so.1.0.0 /lib/libiconv.so /lib/libiconv.so.2 /lib/libiconv.so.2.5.0 /usr /usr/bin /usr/bin/iconv /usr/include /usr/include/iconv.h /usr/include/libcharset.h /usr/include/localcharset.h /usr/lib /usr/lib/charset.alias /usr/lib/libcharset.a /usr/lib/libcharset.la /usr/lib/libcharset.so /usr/lib/libiconv.a /usr/lib/libiconv.la /usr/lib/libiconv.so (..) Best regards. Bernd Lommerzheim [1] http://www.gnu.org/software/libiconv/ [2] https://bugs.gentoo.org/show_bug.cgi?id=354295 [3] https://bugs.gentoo.org/attachment.cgi?id=281101 [4] https://bugs.gentoo.org/attachment.cgi?id=282911
This may sound silly, but what happens if you add: --with-includes=/usr/include --with-libraries=/usr/lib to the configure command used on Gentoo FreeBSD?
Never mind, that's not the issue. I need to update the configure script to try to add -liconv to the linker flags used to compile the test program.
This line in the config.log file says that the -liconv linker flag is properly set: configure:15417: checking for iconv_open in -liconv configure:15452: i686-gentoo-freebsd7.2-gcc -o conftest -O2 -march=i686 -pipe -Wall -L$(top_srcdir)/lib conftest.c -liconv >&5 Does the gcc on FreeBSD not automatically check for the /lib and usr/lib directories? Or will this work if: --with-libraries=/lib:/usr/lib is explicitly added to the proftpd configure command? (If this explicit specification of the FreeBSD library directories works, I would then have to wonder why the FreeBSD gcc doesn't look in those directories automatically.)
I asked Dmitri to build ProFTPD with "--with-libraries=/lib:/usr/lib" on a Gentoo FreeBSD machine but this does not fix this issue. Dmitri mentions that configure always outputs "checking for the default library search path... /lib /usr/lib" even without using "--with-libraries=/lib:/usr/lib". See Gentoo Bug #354295 [1] comment 12 to 14 for my request and Dmitri's answers. [1] https://bugs.gentoo.org/show_bug.cgi?id=354295
Yes, I saw that comment. But it does not answer the question of why the FreeBSD compiler/linker is unable to see the libiconv library in the standard directories. That, to me, appears to the be root of this problem.
For example, on a Mac OSX machine with gettext (which provides libintl and libiconv) installed in a non-standard location, I have to use the following configure command: $ ./configure --enable-nls --with-includes=/path/to/gettext/include --with-libraries=/path/to/gettext/lib ... And in the generated config.log file, when checking for libintl and libiconv, I see: configure:15304: checking for bindtextdomain in -lintl configure:15339: gcc -o conftest -O2 -Wall -I/path/to/gettext/include -L$(top_srcdir)/lib -L/path/to/gettext/lib conftest.c -lintl >&5 configure:15345: $? = 0 configure:15363: result: yes configure:15460: checking for iconv_open in -liconv configure:15495: gcc -o conftest -O2 -Wall -I/path/to/gettext/include -L$(top_srcdir)/lib -L/path/to/gettext/lib conftest.c -liconv >&5 configure:15501: $? = 0 configure:15519: result: yes Notice the appearance of the -I and -L compiler options in both checks. The use of "--with-libraries=/lib:/usr/lib" in the test I requested of you should have at least caused "-L/lib -L/usr/lib" to have appeared in the config.log check for libiconv in the failing Gentoo FreeBSD test.
Just a thought: On a GNU/Linux Debian 32bit system the configure test "checking for iconv_open in -liconv" fails because (I think) there is no library called 'iconv' and iconv support is directly provided by the glibc which is found in the second test "checking for iconv_open in -lc". About the first failing test config.log says: configure:15460: checking for iconv_open in -liconv configure:15495: gcc -o conftest -O2 -Wall -L$(top_srcdir)/lib conftest.c -liconv -ldl >&5 /usr/bin/ld: cannot find -liconv collect2: ld returned 1 exit status configure:15501: $? = 1 It can not find the "iconv" library. But Dmitri reported the following failures in both configure tests (-liconv and -lc): conftest.c:(.text+0x7): undefined reference to `iconv_open' collect2: ld returned 1 exit status Hence I think that it finds the libiconv library but this library does not contain a reference called 'iconv_open' and therefore it is not a issue of finding it rather than of linking against it!? Or did I mix something up?
Good point. The "undefined reference" means that the linker found libiconv (or at least doesn't complain about the -liconv flag). What does: # nm /lib/libiconv.so | grep _open # nm /usr/lib/libiconv.a | grep _open # nm /usr/lib/libiconv.a | grep _open show?
(In reply to comment #8) > # nm /lib/libiconv.so | grep _open nm: /lib/libiconv.so: no symbols > # nm /usr/lib/libiconv.a | grep _open 00010d20 T iconv_open 00010d20 T libiconv_open 000107c0 T libiconv_open_into > # nm /usr/lib/libiconv.a | grep _open the same of course
Hi, ProFTPd maintaers Thank you for your working with this bug... /usr/include/iconv.h has this line: > #define iconv_open libiconv_open This line convert iconv_open to libiconv_open. So if we'd like to detect iconv_open in -liconv, we may need to include this header file (and let the header file convert iconv_open to libiconv_open). Or we can just try to detect libiconv_open instead. So the solution would be - Move detection code after iconv.h detection or - Try to detect libiconv_open() Thanks in advance.
Created attachment 3695 [details] Patches configure.in This patch for configure.in should add the suggested check for the libiconv_open function. After applying this patch, you will need to run `autoconf' to generate the new configure script. Could you apply this patch, and see if the new configure script properly detects the libiconv library when --enable-nls is used for that platform?
(In reply to comment #11) > Could you apply this patch, and see if the new configure script properly > detects the libiconv library when --enable-nls is used for that platform? I just successfully built proftpd-1.3.4a with this patch. # grep iconv /var/tmp/portage/net-ftp/proftpd-1.3.4a/temp/build.log * Applying nls-iconv-gentoo-freebsd-bug3682.patch ... checking for iconv_open in -liconv... no checking for libiconv_open in -liconv... yes checking iconv.h usability... yes checking iconv.h presence... yes checking for iconv.h... yes checking for iconv... yes ...
Excellent news! I'll get this applied to CVS, and backported to the 1.3.4 branch, shortly. Thanks!
Patch committed to CVS, and backported to 1.3.4 branch. The next snapshots should have this patch included.
Resolved in 1.3.4b.