Mac 的操作系统 php make 报错
报错内容如下:
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_do_convert in gdkanji.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_appendl in iconv.o
...
"_libiconv_close", referenced from:
_do_convert in gdkanji.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_decode in iconv.o
...
"_libiconv_open", referenced from:
_do_convert in gdkanji.o
_zif_iconv_substr in iconv.o
_zif_iconv_mime_encode in iconv.o
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_decode in iconv.o
...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sapi/cli/php] Error 1
解决办法:
vi Makefile
# 查找 -liconv
# 删除 -liconv
# 添加 /usr/local/Cellar/libiconv/1.15/lib/libiconv.dylib
# 修改结果为: EXTRA_LIBS = -lcrypto -lssl -lcrypto -lz -lresolv -ledit -lncurses -lpq -lpq -lmcrypt -lltdl -lpng -lz -ljpeg -lcurl -lz -lcrypto -lssl -lcrypto -lm -lxml2 -lz -licucore -lm -lcurl -lldap -lz -lxml2 -lz -licucore -lm -lfreetype -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm -lxml2 -lz -licucore -lm /usr/local/Cellar/libiconv/1.15/lib/libiconv.dylib
# 删除ZEND_EXTRA_LIBS = ‘删除这里的东西’ 变更为: ZEND_EXTRA_LIBS =
再执行make