您好,登錄后才能下訂單哦!
研究 PHP 源碼的時候進行 make 之后報錯:
/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' 錯誤的解決方法
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。