在使用 configure
配置过程中报的错误。
$ ./configure --prefix=/usr/local/php7/ --enable-debug --enable-maintainer-zts --enable-mysqlnd --with-mysqli --with-openssl --enable-pcntl --enable-mbstring --with-curl --enable-fpm
问题一、 openssl问题
和openssl有关(当然,系统中已经安装了openssl)。报如下的错误:
checking for ..../pkg-config
error: Cannot find OpenSSL's <evp.h>
解决方法,
For compilers to find libressl you may need to set:
export LDFLAGS="-L/usr/local/opt/libressl/lib"
export CPPFLAGS="-I/usr/local/opt/libressl/include"
For pkg-config to find libressl you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/libressl/lib/pkgconfig"
问题二、 iconv问题
问题一解决之后,新的问题又来了。
error: Please specify the install prefix of iconv with --with-iconv=<DIR>
解决方法
$ brew install libiconv
先安装libiconv
,然后在configure
中指定--with-iconv
选项。如下
$ ./configure --prefix=/usr/local/php7/ --enable-debug --enable-maintainer-zts --enable-mysqlnd --with-mysqli --with-openssl --enable-pcntl --enable-mbstring --with-curl --enable-fpm --with-iconv=$(brew --prefix libiconv)
make 过程报错
SHLIB_DL_SUFFIX_NAME = so
"Makefile" 1713L, 277679C
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_decode in iconv.o
_php_iconv_stream_filter_dtor in iconv.o
...
"_libiconv_open", referenced from:
_php_iconv_string in iconv.o
__php_iconv_strlen in iconv.o
__php_iconv_substr in iconv.o
__php_iconv_strpos in iconv.o
__php_iconv_mime_encode in iconv.o
__php_iconv_mime_decode in iconv.o
_php_iconv_stream_filter_ctor 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)
解决办法: 编辑 Makefile 找到 EXTRA_LIBS = 。。。 将 -liconv 替换成 /usr/local/Cellar/libiconv/1.16/lib/libiconv.dylib
可以根据自己系统的实际路径替换