我已经将Mac升级到macOS 10.12.0 Sierra,并且我正在尝试将PHP升级到7.0.9版本,但是“make test”失败了:
Undefined symbols for architecture x86_64:
"_libiconv", referenced from:
_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
_php_iconv_stream_filter_append_bucket in iconv.o
...
"_libiconv_close", referenced from:
_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
_php_iconv_stream_filter_factory_create in iconv.o
...
"_libiconv_open", referenced from:
_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
_php_iconv_stream_filter_factory_create 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: *** [libs/libphp7.bundle] Error 1
我编译它:
./configure --prefix=/usr/local/php5 --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --with-config-file-path=/etc --with-zlib --with-zlib-dir=/usr --with-openssl=/usr/local --enable-exif --enable-ftp --enable-mbstring --enable-mbregex --enable-sockets --with-pdo-mysql=mysqlnd --with-mysqli=mysqlnd --with-apxs2=/usr/local/apache2/bin/apxs --enable-zip --with-curl
并尝试添加不同的'--with-iconv-dir ='选项,但总是得到相同的未定义符号错误。
我已经下载并编译了libiconv无济于事。甚至配置编译:
CFLAGS =' - arch x86_64'CCFLAGS =' - arch x86_64'CXXFLAGS =' - arch x86_64'./configure
但这没有任何区别。有什么建议?
任何帮助将非常感激。
这可能会解决问题
vim Makefile
find EXTRA_LDFALGS and EXTRA_LDFLAGS_PROGRAMS
remove L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/usr/lib
(libiconv will install in /usr/local/opt/libiconv/)
-liconv
改为/usr/local/opt/libiconv/lib/libiconv.dylib
原因如下:
libiconv.dylib
有自己的dir/usr/lib/libiconv.dylib
,不包含_libiconv _libiconv_close . founctions
。更新到新的libiconv版本并引用它将解决此问题