php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #11654 configure fails on iconv_open
Submitted: 2001-06-25 06:21 UTC Modified: 2001-06-26 07:33 UTC
From: tom at minnesota dot com Assigned:
Status: Closed Package: Sablotron XSL
PHP Version: 4.0.6 OS: NetBSD/Alpha 1.5W-current
Private report: No CVE-ID: None
 [2001-06-25 06:21 UTC] tom at minnesota dot com
Sablot-0.60 (also 0.5x), PHP-4.0.7-dev

i tried 'configure' with and without --iconv-dir=/usr/pkg flag. in either case, i get the following error:

---cut---
configure:46596: checking for iconv_open in -lc
configure:46615: gcc -o conftest -DLIBICONV_PLUG  -DNETBSD -DEAPI -DUSE_EXPAT -I/usr/pkg/include
-Wl,-export-dynamic   -Wl,-R/usr/lib -L/usr/lib   -Wl,-R/usr/pkg/lib -L/usr/pkg/lib   -Wl,-R/usr/
local/lib -L/usr/local/lib   -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib -L/usr/pkg/lib -R/usr/pkg/lib
-L/usr/pkg/lib -R/usr/local/lib/mysql -L/usr/local/lib/mysql -R/usr/local/lib -L/usr/local/lib co
nftest.c -lc  -lexpat -lexpat -lsablot -lpq -lmysqlclient -lz -lgd -lttf -lz -lcrypt -lresolv -lm
 -lz -lpng -lm -lc -lpng -ljpeg -lttf -lintl -lXpm -lX11 -lresolv -lgcc 1>&5
/tmp/ccpa03fT.o: In function `main':
conftest.c(.text+0x18): undefined reference to `iconv_open'
conftest.c(.text+0x1c): undefined reference to `iconv_open'
collect2: ld returned 1 exit status
configure: failed program was:
#line 46604 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char iconv_open();

int main() {
iconv_open()
; return 0; }
---cut---

the type declared above doesn't match with libiconv's type for iconv_open (should be iconv_t instead of char). in addition, iconv_open is an alias function for libiconv_open and therefore will fail if "#include <iconv.h>" isn't included.

here is my env setup:

---cut---
rm config.cache 
export LIBS="-lz -lpng -lm -lc -lpng -ljpeg -lttf -lintl -lXpm -lX11" && \
export LDFLAGS="-Wl,-export-dynamic \
  -Wl,-R/usr/lib -L/usr/lib \
  -Wl,-R/usr/pkg/lib -L/usr/pkg/lib \
  -Wl,-R/usr/local/lib -L/usr/local/lib \
  -Wl,-R/usr/X11R6/lib -L/usr/X11R6/lib"

./configure \
--with-apxs \
--disable-pear \
--with-gd=/usr/pkg \
--with-sablot=/usr/local \
--with-expat-dir=/usr/local \
--without-iconv \ <== tried w/ --with-iconv=/usr/local also
--with-pgsql=/usr/local \
--with-mysql=/usr/local \
--enable-libgcc \
--with-gnu-ld \
--with-zlib \
--with-system-regex \
--with-config-file-path=/usr/local/etc \
--enable-track-vars \
--enable-force-cgi-redirect \
--enable-discard-path \
--enable-memory-limit \
--enable-sysvsem \
--enable-sysvshm \
--enable-sockets \
--with-ttf=/usr/pkg \
--enable-freetype-4bit-antialias-hack

---cut---

please note, according to the docs from Sablot, iconv support is optional. i think php's config needs to change to reflect the use of libiconv with Sablot 0.5X - 0.60.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-06-25 11:26 UTC] tom at minnesota dot com
here are the patches to fix this. dev team, please close this case after you have patched php-4.0.7-dev.

--- iconv/config.m4.orig        Mon Jun 25 08:42:44 2001
+++ iconv/config.m4     Mon Jun 25 09:30:37 2001
@@ -29,7 +29,7 @@

   if test -e $ICONV_DIR/lib/libconv.a -o -e $ICONV_DIR/lib/libiconv.so ; then
     PHP_ADD_LIBRARY_WITH_PATH(iconv, $ICONV_DIR/lib, ICONV_SHARED_LIBADD)
-    AC_CHECK_LIB(iconv, iconv_open, AC_DEFINE(HAVE_ICONV, 1, [ ]))
+    AC_CHECK_LIB(iconv, libiconv_open, AC_DEFINE(HAVE_LIBICONV, 1, [ ]))
   else
     AC_CHECK_LIB(c, iconv_open, AC_DEFINE(HAVE_ICONV, 1, [ ]))
   fi

--- sablot/config.m4.orig       Mon Jun 25 10:10:56 2001
+++ sablot/config.m4    Mon Jun 25 10:10:22 2001
@@ -49,7 +49,11 @@
   fi

   found_iconv=no
-  AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
+  if test -e $ICONV_DIR/lib/libconv.a -o -e $ICONV_DIR/lib/libiconv.so ; then
+    AC_CHECK_LIB(iconv, libiconv_open, found_iconv=yes)
+  else
+    AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
+  fi
   if test "$found_iconv" = "no"; then
     if test "$PHP_ICONV" = "no"; then
       for i in /usr /usr/local; do

--- xslt/config.m4.orig Mon Jun 25 10:11:57 2001
+++ xslt/config.m4      Mon Jun 25 10:13:13 2001
@@ -65,7 +65,11 @@
     fi

     found_iconv=no
-    AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
+    if test -e $ICONV_DIR/lib/libconv.a -o -e $ICONV_DIR/lib/libiconv.so ; then
+      AC_CHECK_LIB(iconv, libiconv_open, found_iconv=yes)
+    else
+      AC_CHECK_LIB(c, iconv_open, found_iconv=yes)
+    fi
     if test "$found_iconv" = "no"; then
       if test "$PHP_ICONV" = "no"; then
         for i in /usr /usr/local; do

 [2001-06-25 13:34 UTC] tom at minnesota dot com
forgot one patch:

--- iconv/iconv.c.orig  Mon Jun 25 11:14:39 2001
+++ iconv/iconv.c       Mon Jun 25 11:08:40 2001
@@ -25,7 +25,7 @@

 #include "php.h"

-#if HAVE_ICONV
+#if HAVE_ICONV || HAVE_LIBICONV

 #include <iconv.h>

IMPORTANT:
one thing to note about these patches is that one would have to run ./buildconf inorder for it to make a custom configure script. maybe someone could figure out away to change these patches so that it would build a generic configure to ship for releases that would work better out of the box for both systems with builtin iconv and libiconv.
 [2001-06-26 07:33 UTC] sniper@php.net
This should be fixed in CVS now.

--Jani

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 14:01:30 2024 UTC