I'm trying to recompile PHP 5.3.3 on mac os snow leopard with iconv and getting the following error:
Undefined symbols:
"_libiconv_open", referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
_php_iconv_stream_filter_ctor in iconv.o
"_libiconv", referenced from:
__php_iconv_appendl in iconv.o
__php_iconv_appendl in iconv.o
_php_iconv_string in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
_php_iconv_stream_filter_append_bucket in iconv.o
_php_iconv_stream_filter_append_bucke开发者_开发知识库t in iconv.o
_php_iconv_stream_filter_append_bucket in iconv.o
(maybe you meant: __libiconv_version)
"_libiconv_close", referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
__php_iconv_mime_decode in iconv.o
_php_iconv_stream_filter_dtor in iconv.o
I know it's old problem and I could not find the right solution in google.
Any ideas how to fix it will be appreciated.
I'm using:
./configure --prefix=/usr/local/php5 --with-iconv=/usr/local --with-apxs2=/usr/sbin/apxs --enable-pdo --with-gd=/usr/local --with-zlib --with-jpeg-dir=/usr/local/lib --with-png-dir=/usr/local/lib --with-libxml-dir=/usr/local --with-curl --with-mcrypt --with-pdo-mysql=/usr/local/mysql --with-mysqli=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --with-mhash --with-libxml-dir=/usr/local --with-t1lib=/usr/local --with-xsl --with-freetype-dir=/usr/local --with-gettext --with-bz2=/usr --with-openssl=/usr/local/ssl --enable-bcmath --enable-calendar --enable-cgi --enable-exif --enable-ftp --enable-gd-native-ttf --enable-mbstring --enable-soap --enable-sqlite-utf8 --enable-cli --enable-wddx --enable-zip
And I have recompiled libiconv 1.13.1 as well.
Hola! I had this same problem on both php 5.3.3 and php 5.3.5. My errors read like this on 5.3.5
Undefined symbols:
"_libiconv", referenced from:
__php_iconv_strlen in iconv.o
_php_iconv_string in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_appendl in iconv.o
__php_iconv_appendl in iconv.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_stream_filter_append_bucket in iconv.o
_php_iconv_stream_filter_append_bucket in iconv.o
(maybe you meant: __libiconv_version)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [libs/libphp5.bundle] Error 1
the solution is alterations to the file ext/iconv/iconv.c
open it up and change around line 185 to look like this
- #if defined(HAVE_LIBICONV) && defined(ICONV_ALIASED_LIBICONV)
- #define iconv iconv
- #endif
basically changing "libiconv" to just "iconv"
that solution worked for me on both php 5.3.3 and 5.3.5 on snowleopard 10.6.4
peace
This is one of a class of problems compiling PHP on Mac OS X that relates to multiple versions of libraries -- the PHP developers' response is almost invariably "Just delete the extra libraries. Problem solved" -- completely ignoring the fact that there are often quite legitimate reasons to have multiple libs installed. They refuse to address the issue.
This post: http://blog.yimingliu.com/2009/02/24/missing-library-symbols-while-compiling-php-528/
covers the case of libxml, but it's a similar problem.
精彩评论