2012年10月29日星期一

编译 PHP 时报 undefined reference to `libiconv_open'

编译 PHP 5.4.7,配置参数:
[bash]
./configure --prefix=/usr/local/php --with-freetype-dir --with-jpeg-dir --with-png-dir --with-curl --with-gd --with-iconv --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --with-gettext --with-zlib --enable-bcmath --enable-ftp --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-gd-native-ttf --enable-mbstring --enable-pcntl --enable-pdo --enable-sockets --enable-shmop --enable-zip --disable-ipv6 --disable-debug --without-pear
[/bash]
configure 正常,make 时报错:
[bash]
ext/gd/libgd/gdkanji.o: In function `do_convert':
/usr/local/src/php-5.4.7/ext/gd/libgd/gdkanji.c:350: undefined reference to `libiconv_open'
/usr/local/src/php-5.4.7/ext/gd/libgd/gdkanji.c:365: undefined reference to `libiconv'
/usr/local/src/php-5.4.7/ext/gd/libgd/gdkanji.c:381: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_strlen':
.....
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1
[/bash]

看错误提示,gd 库调用 libiconv, 但没找到 libiconv。下载 libiconv,编译,安装。

再重新配置 PHP ,加上 --with-iconv=/usr/local/lib
[bash]
[root@www php-5.4.7]# ./configure --prefix=/usr/local/php --with-freetype-dir --with-jpeg-dir --with-png-dir --with-curl --with-gd --with-iconv --with-mcrypt --with-mhash --with-mysql=mysqlnd --with-mysqli=mysqlnd --with-openssl --with-pdo-mysql=mysqlnd --with-gettext --with-zlib --enable-bcmath --enable-ftp --enable-fpm --with-fpm-user=www --with-fpm-group=www --enable-gd-native-ttf --enable-mbstring --enable-pcntl --enable-pdo --enable-sockets --enable-shmop --enable-zip --disable-ipv6 --disable-debug --without-pear
[root@www php-5.4.7]# make
[root@www php-5.4.7]# make install
[/bash]

没有评论 :

发表评论