php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42547 ext/iconv/iconv.c:2426: undefined reference to `libiconv_open'
Submitted: 2007-09-04 19:01 UTC Modified: 2007-10-19 01:00 UTC
Votes:10
Avg. Score:4.1 ± 0.8
Reproduced:9 of 9 (100.0%)
Same Version:6 (66.7%)
Same OS:3 (33.3%)
From: dawidpachla at gmail dot com Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.2.4 OS: CentOS 5 with DirectAdmin
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dawidpachla at gmail dot com
New email:
PHP Version: OS:

 

 [2007-09-04 19:01 UTC] dawidpachla at gmail dot com
Description:
------------
I use CentOS 5 with newest DirecAdmin, apache2, mod_security and php 5.2.3 (when I upgraded from 4.4.7 to 5.2.3 everything was ok).

Everything is compiling fine until:

 reference to `libiconv'
/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:1211: undefined reference to `libiconv'
/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:1242: undefined reference to `libiconv'
ext/iconv/.libs/iconv.o:/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:1286: more undefined references to `libiconv' follow
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:2426: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

This is my configuration file:

./configure \
        --with-apxs2 \
        --with-curl \
        --with-curl=/usr/local/lib \
        --with-gd \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-kerberos \
        --with-openssl \
        --with-mcrypt \
        --with-mhash \
        --with-mysql=/usr \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-xml \
        --with-zlib \
        --with-zlib-dir=/usr/local/lib \
        --with-zip \
        --enable-bcmath \
        --enable-calendar \
        --enable-ftp \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-track-vars \
        --enable-mbstring \
        --enable-memory-limit




Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-05 13:24 UTC] jani@php.net
You seem to have libiconv in your system. Where is it located and is that location in LD_LIBRARY_PATH? (or /etc/ld.so.conf* file or directory..)

 [2007-09-11 20:27 UTC] dawidpachla at gmail dot com
it's /usr/local/lib
 [2007-09-12 11:57 UTC] jani@php.net
This is wrong way to pass base install dir:
-with-curl=/usr/local/lib 

This is the correct way:

-with-curl=/usr/local

Fix these in your configure line. (There is no --with/--enable option in PHP configure that expects it to have /lib in the path!)
 [2007-09-12 15:04 UTC] dawidpachla at gmail dot com
I edited the configure file, so it looks like that:

#!/bin/sh
./configure \
        --with-apxs2 \
        --with-curl \
        --with-curl=/usr/local \
        --with-gd \
        --with-gettext \
        --with-jpeg-dir=/usr/local/lib \
        --with-kerberos \
        --with-openssl \
        --with-mcrypt \
        --with-mhash \
        --with-mysql=/usr \
        --with-pear \
        --with-png-dir=/usr/local/lib \
        --with-xml \
        --with-zlib \
        --with-zlib-dir=/usr/local/lib \
        --with-zip \
        --enable-bcmath \
        --enable-calendar \
        --enable-ftp \
        --enable-magic-quotes \
        --enable-sockets \
        --enable-track-vars \
        --enable-mbstring \
        --enable-memory-limit \
        --enable-libxml


But I still get the same error when i try to compile it:

/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:1242: undefined                                                                              reference to `libiconv'
ext/iconv/.libs/iconv.o:/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/                                                                             iconv.c:1286: more undefined references to `libiconv' follow
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:2426: undefined                                                                              reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
[root@server customapache]#
 [2007-09-13 10:21 UTC] jani@php.net
I meant EVERY option in PHP configure, not just the one.
Anyway, try this short version instead:

# rm config.cache && ./configure && make

 [2007-09-13 16:07 UTC] dawidpachla at gmail dot com
When I changed all /usr/local/lib to /usr/local I had the same error as before, when I used rm config.cache && ./configure && make I got the following error:

/usr/local/directadmin/customapache/php-5.2.4/main/rfc1867.c:1185: undefined reference to `php_mb_gpc_encoding_converter'
main/.libs/output.o: In function `php_ob_init_named':
/usr/local/directadmin/customapache/php-5.2.4/main/output.c:438: undefined reference to `php_ob_gzhandler_check'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
 [2007-09-18 12:33 UTC] jani@php.net
Of course you should do "make clean", I forgot to mention that:

# rm config.cache && ./configure && make clean && make

 [2007-09-18 15:12 UTC] dawidpachla at gmail dot com
still the same error :/

/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:1242: undefined reference to `libiconv'
ext/iconv/iconv.o:/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:1286: more undefined references to `libiconv' follow
ext/iconv/iconv.o: In function `php_iconv_stream_filter_ctor':
/usr/local/directadmin/customapache/php-5.2.4/ext/iconv/iconv.c:2426: undefined reference to `libiconv_open'
collect2: ld returned 1 exit status
make: *** [sapi/cgi/php-cgi] Error 1
 [2007-09-19 13:28 UTC] jani@php.net
What does this output:
# grep ICONV main/php_config.h 

 [2007-09-19 14:42 UTC] dawidpachla at gmail dot com
grep: main/php_config.h: No such file or directory
 [2007-09-21 09:15 UTC] jani@php.net
Try find that file first. It's $top_builddir/main/php_config.h
 [2007-10-08 10:36 UTC] dawidpachla at gmail dot com
Here's the output of # grep ICONV main/php_config.h after 'compilation':

[root@server php-5.2.4]# grep ICONV main/php_config.h
/* #undef HAVE_LIBICONV */
/* #undef HAVE_GICONV_H */
/* #undef HAVE_LIBICONV */
#define HAVE_ICONV 1
#define PHP_ICONV_IMPL "glibc"
/* #undef HAVE_BSD_ICONV */
#define PHP_ICONV_IMPL "glibc"
#define HAVE_GLIBC_ICONV 1
#define PHP_ICONV_IMPL "glibc"
#define ICONV_SUPPORTS_ERRNO 0
#define ICONV_SUPPORTS_ERRNO 0
#define ICONV_SUPPORTS_ERRNO 0
#define PHP_ICONV_H_PATH </usr/local/include/iconv.h>
/* #undef COMPILE_DL_ICONV */
/* #undef HAVE_LIBICONV */
/* #undef HAVE_GICONV_H */
/* #undef HAVE_LIBICONV */
#define HAVE_ICONV 1
[root@server php-5.2.4]#
 [2007-10-11 14:06 UTC] jani@php.net
Is there some reason you have libiconv installed in /usr/local when your glibc provides the same stuff? Did something else require it? As the fix is to simply uninstall libiconv..
 [2007-10-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2008-06-27 14:39 UTC] ranrig at gmail dot com
Whenever you see "undefined reference to `libiconv_open'", try

make CFLAGS=-liconv
 [2008-11-16 14:53 UTC] milind dot koyande at gmail dot com
I have used --without-iconv with ./configure and make worked fine.

Hope it will work for you too.

-Milind ( http://trulymanaged.com )
 [2008-11-25 00:55 UTC] justincase at mailcatch dot com
To fix the error:
undefined reference to `libiconv_open'

Run configure like this:
[root@david php-5.2.4]# ./configure CFLAGS=-liconv
 [2009-09-12 08:59 UTC] pjin at mail dot ru
I used EXTRA_CFLAGS=-liconv instead of just CFLAGS=liconv
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC