在mac os snow leopard上编译PHP 5.3.3。 iconv链接问题

时间:2010-09-10 22:06:23

标签: php compilation osx-snow-leopard

我正在尝试使用iconv在mac os snow leopard上重新编译PHP 5.3.3并收到以下错误:

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_bucket 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

我知道这是一个老问题,我无法在谷歌找到合适的解决方案。

任何想法如何解决它将不胜感激。

我正在使用:

./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

我也重新编译了libiconv 1.13.1。

2 个答案:

答案 0 :(得分:2)

HOLA!我在php 5.3.3和php 5.3.5上都有同样的问题。我在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

解决方案是文件ext / iconv / iconv.c的改动

打开它并在第185行周围改变,看起来像这样

  • #if defined(HAVE_LIBICONV)&&定义(ICONV_ALIASED_LIBICONV)
  • #define iconv iconv
  • #ENDIF

基本上将“libiconv”改为“iconv”

该解决方案适用于snowleopard 10.6.4上的php 5.3.3和5.3.5

和平

答案 1 :(得分:0)

这是在Mac OS X上编译PHP的一类问题之一,它与多个版本的库有关 - PHP开发人员'响应几乎总是"只需删除额外的库。问题解决了#34; - 完全忽略了通常非常合理的原因安装多个库的事实。他们拒绝解决这个问题。

这篇文章:http://blog.yimingliu.com/2009/02/24/missing-library-symbols-while-compiling-php-528/

涵盖了libxml的情况,但它也是一个类似的问题。