undefined reference to `libiconv_open 无法编译PHP

时间:2022-11-25 23:49:20

解决方法:
#wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.13.1.tar.gz
#tar -zxvf libiconv-1.13.1.tar.gz
#cd libiconv-1.13.1
# ./configure --prefix=/usr/local/libiconv
# make
# make install

再检查php,指定 iconv的位置  --with-iconv=/usr/local/libiconv
#./configure --with-mysql=/backup/mysql --with-freetype-dir --with-jpeg-dir --with-png-dir --with-zlib --with-curl --with-gd --enable-gd-native-ttf --with-apxs2=/usr/local/apache/bin/apxs --enable-sockets --with-iconv=/usr/local/libiconv
#make
#make install

另一种解决方法为去除iconv模块也能正常编译php,如下:
編輯 Makefile 大約 77 行左右的地方:
EXTRA_LIBS = ..... -lcrypt
在最後加上 -liconv,例如:
EXTRA_LIBS = ..... -lcrypt -liconv
再运行make就可以了。

最后一种方法:由tonyty163提供:

#make ZEND_EXTRA_LIBS='-liconv'
#make install

 http://blog.chinaunix.net/uid-25266990-id-2915395.html