如何在OS X 10.9上用OpenSSL编译PHP? [英] How to compile PHP with OpenSSL on OS X 10.9?
问题描述
我正在尝试从源代码编译PHP 5.6.10,但遇到以下问题:
I'm trying to compile PHP 5.6.10 from the source, and I encountered the following problem:
Undefined symbols for architecture x86_64:
"_PKCS5_PBKDF2_HMAC", referenced from:
_zif_openssl_pbkdf2 in openssl.o
"_TLSv1_1_client_method", referenced from:
_php_openssl_setup_crypto in xp_ssl.o
"_TLSv1_1_server_method", referenced from:
_php_openssl_setup_crypto in xp_ssl.o
"_TLSv1_2_client_method", referenced from:
_php_openssl_setup_crypto in xp_ssl.o
"_TLSv1_2_server_method", referenced from:
_php_openssl_setup_crypto in xp_ssl.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/libphp5.bundle] Error 1
OpenSSL是通过Brew安装的.在PHP中包含--with-openssl=/usr/local/Cellar/openssl/1.0.2c
OpenSSL is installed via Brew. In PHP included like --with-openssl=/usr/local/Cellar/openssl/1.0.2c
P.S.
在尝试仅将/usr
用于OpenSSL之前,但遇到了相同的错误.
P.S.
Before tried to use just /usr
for OpenSSL but got the same error.
推荐答案
Makefile的一行带有EXTRA_LIBS
,类似于:
The Makefile has a line with EXTRA_LIBS
, something like:
EXTRA_LIBS = -lresolv -lmcrypt -lltdl -liconv-lm -lxml2 -lcurl -lssl -lcrypto
删除所有出现的-lssl
和-lcrypto
,并将完整路径添加到libssl.dylib
和libcrypto.dylib
(将openssl链接到/usr/local/opt/openssl/lib/)
Remove all occurrences of -lssl
and -lcrypto
and add the full path to libssl.dylib
and libcrypto.dylib
(brew links openssl to /usr/local/opt/openssl/lib/)
EXTRA_LIBS = -lresolv -lmcrypt /usr/local/opt/openssl/lib/libssl.dylib /usr/local/opt/openssl/lib/libcrypto.dylib -lltdl -liconv-lm -lxml2 -lcurl
这篇关于如何在OS X 10.9上用OpenSSL编译PHP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!