php 5.5 collect2: ld returned 1 exit status

Make编译安装php出现collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1的解决方法

-lresolv -lcrypt -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lrt -lm -ldl -lnsl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcurl -lxml2 -lz -lm -ldl -lfreetype -lxml2 -lz -lm -ldl -lcrypt -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lxml2 -lz -lm -ldl -lssl -lcrypto -lcrypt -o sapi/cli/php

ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_dtor’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:2516: undefined reference to `libiconv_close’
ext/iconv/.libs/iconv.o: In function `_php_iconv_strlen’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:690: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:713: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:747: undefined reference to `libiconv_close’
ext/iconv/.libs/iconv.o: In function `_php_iconv_appendl’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:401: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:438: undefined reference to `libiconv’
ext/iconv/.libs/iconv.o: In function `_php_iconv_substr’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:810: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:834: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:889: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:893: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:842: undefined reference to `libiconv_open’
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_encode’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:1130: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1144: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1315: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1346: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1402: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1405: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1263: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1215: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1247: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1389: undefined reference to `libiconv’
ext/iconv/.libs/iconv.o: In function `_php_iconv_mime_decode’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:1440: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1936: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1939: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1551: undefined reference to `libiconv_close’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1554: undefined reference to `libiconv_open’
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:2542: undefined reference to `libiconv_open’
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:2667: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:2588: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:2666: undefined reference to `libiconv’
ext/iconv/.libs/iconv.o: In function `php_iconv_string’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:512: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:524: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:542: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:553: undefined reference to `libiconv_close’
ext/iconv/.libs/iconv.o: In function `_php_iconv_strpos’:
/usr/src/php-5.5.38/ext/iconv/iconv.c:938: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/iconv/iconv.c:966: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/iconv/iconv.c:1080: undefined reference to `libiconv_close’
ext/gd/libgd/.libs/gdkanji.o: In function `do_convert’:
/usr/src/php-5.5.38/ext/gd/libgd/gdkanji.c:350: undefined reference to `libiconv_open’
/usr/src/php-5.5.38/ext/gd/libgd/gdkanji.c:365: undefined reference to `libiconv’
/usr/src/php-5.5.38/ext/gd/libgd/gdkanji.c:381: undefined reference to `libiconv_close’
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] 错误 1

 

在centos7里编译php5.5现现发生「undefined reference to libiconv_open’」之类的错误信息。

解决办法:

建立软链接
 
ln -s /usr/local/lib/libiconv.so.2 /usr/lib64/
 
再执行Make
 
make ZEND_EXTRA_LIBS=’-liconv’
 


posted @ 2019-10-29 11:30  陈俊武  阅读(2058)  评论(0编辑  收藏  举报