现在的位置: 首页 > IT运维 > 正文

undefined reference to `libiconv_open\' @PHP 5.3.8@解决方法

2011年11月01日 IT运维 ⁄ 共 5155字 评论数 2 ⁄ 被围观 2,135+

PHP 5.3.8编译时出现如下错误

ext/gd/libgd/.libs/gdkanji.o: In function `do_convert\':
/var/soft/php-5.3.8/ext/gd/libgd/gdkanji.c:350: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/gd/libgd/gdkanji.c:365: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/gd/libgd/gdkanji.c:381: undefined reference to `libiconv_close\'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:592: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:615: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:649: undefined reference to `libiconv_close\'
ext/iconv/.libs/iconv.o: In function `php_iconv_string\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:430: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:442: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:456: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:467: undefined reference to `libiconv_close\'
ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:840: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:868: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:982: undefined reference to `libiconv_close\'
ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:337: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:374: undefined reference to `libiconv\'
ext/iconv/.libs/iconv.o: In function `_php_iconv_substr\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:712: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:736: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:791: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:795: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:744: undefined reference to `libiconv_open\'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:1342: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1838: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1841: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1453: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1456: undefined reference to `libiconv_open\'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:2473: undefined reference to `libiconv_close\'
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:1032: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1046: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1304: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1307: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1165: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1117: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1149: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1307: undefined reference to `libiconv_close\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1217: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1248: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:1291: undefined reference to `libiconv\'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:2623: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/iconv/iconv.c:2623: undefined reference to `libiconv\'
ext/iconv/.libs/iconv.o:/var/soft/php-5.3.8/ext/iconv/iconv.c:2545: more undefined references to `libiconv\' follow
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor\':
/var/soft/php-5.3.8/ext/iconv/iconv.c:2499: undefined reference to `libiconv_open\'
ext/xmlrpc/libxmlrpc/.libs/encodings.o: In function `convert\':
/var/soft/php-5.3.8/ext/xmlrpc/libxmlrpc/encodings.c:73: undefined reference to `libiconv_open\'
/var/soft/php-5.3.8/ext/xmlrpc/libxmlrpc/encodings.c:81: undefined reference to `libiconv\'
/var/soft/php-5.3.8/ext/xmlrpc/libxmlrpc/encodings.c:101: undefined reference to `libiconv_close\'
collect2: ld returned 1 exit status
make: *** [sapi/fpm/php-fpm] 错误 1

表面看,是libiconv安装问题,重装libiconv之后问题依旧,网上看有人舍弃libiconv,使用 --without-iconv,我觉的不可取,这样是回避问题。

找了n久,终于找到bug所在: 在执行完 ./configure ... 之后,修改下 Makefile,找到其中的

EXTRA_LIBS = -lcrypt -lz -lcrypt -lrt -lmysqlclient -lmcrypt -lldap -llber -lfreetype -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt

在后面添加 -liconv,即修改为:

EXTRA_LIBS = -lcrypt -lz -lcrypt -lrt -lmysqlclient -lmcrypt -lldap -llber -lfreetype -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lrt -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lcurl -ldl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lidn -lssl -lcrypto -lz -lxml2 -lz -lm -lssl -lcrypto -ldl -lz -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -liconv

继续make && make install, 打完收工!

目前有 2 条留言 其中:访客:1 条, 博主:1 条

  1. 晓辉 : 2011年11月02日16:04:37  -49楼

    可以用这样的命令来执行 make ZEND_EXTRA_LIBS='-liconv' && make install

给我留言

您必须 [ 登录 ] 才能发表留言!

×
#