undefinedreferenceto`libico-创新互联

研究 PHP 源码的时候进行 make 之后报错:

10年积累的成都做网站、成都网站设计经验,可以快速应对客户对网站的新想法和需求。提供各种问题对应的解决方案。让选择我们的客户得到更好、更有力的网络服务。我虽然不认识你,你也不认识我。但先做网站设计后付款的网站建设流程,更有湘潭免费网站建设让你可以放心的选择与我们合作。
/cli/ps_title.o sapi/cli/php_cli_process_title.o -lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lxml2 -lsqlite3 -lxml2 -lsqlite3 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lcrypt  -o sapi/cli/php
ext/iconv/iconv.o: In function `php_iconv_stream_filter_dtor':
/home/work/tmp/php-src/ext/iconv/iconv.c:2513: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `php_iconv_stream_filter_ctor':
/home/work/tmp/php-src/ext/iconv/iconv.c:2534: undefined reference to `libiconv_open'
ext/iconv/iconv.o: In function `_php_iconv_strlen':
/home/work/tmp/php-src/ext/iconv/iconv.c:668: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:692: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:726: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_appendl':
/home/work/tmp/php-src/ext/iconv/iconv.c:391: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:425: undefined reference to `libiconv'
ext/iconv/iconv.o: In function `_php_iconv_substr':
/home/work/tmp/php-src/ext/iconv/iconv.c:789: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:813: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:868: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:872: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:821: undefined reference to `libiconv_open'
ext/iconv/iconv.o: In function `_php_iconv_mime_encode':
/home/work/tmp/php-src/ext/iconv/iconv.c:1107: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:1121: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:1293: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:1325: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:1381: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:1384: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:1240: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:1192: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:1224: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:1368: undefined reference to `libiconv'
ext/iconv/iconv.o: In function `_php_iconv_mime_decode':
/home/work/tmp/php-src/ext/iconv/iconv.c:1419: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:1941: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:1944: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:1557: undefined reference to `libiconv_close'
/home/work/tmp/php-src/ext/iconv/iconv.c:1560: undefined reference to `libiconv_open'
ext/iconv/iconv.o: In function `php_iconv_stream_filter_append_bucket':
/home/work/tmp/php-src/ext/iconv/iconv.c:2578: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:2651: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:2650: undefined reference to `libiconv'
ext/iconv/iconv.o: In function `php_iconv_string':
/home/work/tmp/php-src/ext/iconv/iconv.c:497: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:506: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:522: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:532: undefined reference to `libiconv_close'
ext/iconv/iconv.o: In function `_php_iconv_strpos':
/home/work/tmp/php-src/ext/iconv/iconv.c:916: undefined reference to `libiconv_open'
/home/work/tmp/php-src/ext/iconv/iconv.c:944: undefined reference to `libiconv'
/home/work/tmp/php-src/ext/iconv/iconv.c:1058: undefined reference to `libiconv_close'
collect2: error: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

表面看,是libiconv安装问题,重装libiconv之后问题依旧,网上看有人舍弃libiconv,使用 –without-iconv,觉得不可取,这样是回避问题。 找了n久,终于找到bug所在: 在执行完 ./configure …之后,修改下 Makefile,找到其中的

EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lxml2 -lsqlite3 -lxml2 -lsqlite3 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lcrypt

在其后增加一个 -liconv 参数:

EXTRA_LIBS = -lcrypt -lresolv -lcrypt -lrt -lrt -lm -ldl -lxml2 -lsqlite3 -lxml2 -lsqlite3 -lxml2 -lcrypt -lxml2 -lxml2 -lxml2 -lcrypt -liconv

参考:
PHP 编译安装时出现 undefined reference to `libiconv' 错误的解决方法

另外有需要云服务器可以了解下创新互联cdcxhl.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


名称栏目:undefinedreferenceto`libico-创新互联
网站地址:http://azwzsj.com/article/dgsisi.html