开发者社区> 问答> 正文

编译安装PHP7.0的时候报错

/usr/local/src/php-7.0.12/ext/openssl/openssl.c:688:4: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] to_add = ASN1_STRING_data(str); ^~~~~~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘asn1_time_to_time_t’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:739:2: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] if (ASN1_STRING_length(timestr) != strlen((const char)ASN1_STRING_data(timestr))) { ^~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c:754:2: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] strbuf = estrdup((char *)ASN1_STRING_data(timestr)); ^~~~~~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘php_openssl_get_evp_md_from_algo’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1095:24: warning: implicit declaration of function ‘EVP_dss1’; did you mean ‘EVP_sm3’? [-Wimplicit-function-declaration] mdtype = (EVP_MD *) EVP_dss1(); ^~~~~~~~ EVP_sm3 /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1095:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] mdtype = (EVP_MD *) EVP_dss1(); ^ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_spki_export_challenge’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1783:2: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] RETVAL_STRING((char *) ASN1_STRING_data(spki->spkac->challenge)); ^~~~~~~~~~~~~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘openssl_x509v3_subjectAltName’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1941:15: error: dereferencing pointer to incomplete type ‘X509_EXTENSION’ {aka ‘struct X509_extension_st’} p = extension->value->data; ^~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1962:5: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] BIO_write(bio, ASN1_STRING_data(as), ^~~~~~~~~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1968:5: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] BIO_write(bio, ASN1_STRING_data(as), ^~~~~~~~~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c:1974:5: warning: ‘ASN1_STRING_data’ is deprecated [-Wdeprecated-declarations] BIO_write(bio, ASN1_STRING_data(as), ^~~~~~~~~ In file included from /usr/include/openssl/opensslconf.h:42, from /usr/include/openssl/evp.h:13, from /usr/local/src/php-7.0.12/ext/openssl/openssl.c:44: /usr/include/openssl/asn1.h:554:1: note: declared here DEPRECATEDIN_1_1_0(unsigned char *ASN1_STRING_data(ASN1_STRING *x)) ^~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_x509_parse’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:2019:10: error: dereferencing pointer to incomplete type ‘X509’ {aka ‘struct x509_st’} if (cert->name) { ^~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘php_openssl_is_private_key’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:3526:14: error: dereferencing pointer to incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’} switch (pkey->type) { ^~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘php_openssl_pkey_init_dsa’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:3598:10: error: dereferencing pointer to incomplete type ‘DSA’ {aka ‘struct dsa_st’} if (!dsa->p || !dsa->q || !dsa->g) { ^~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘php_openssl_pkey_init_dh’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:3621:9: error: dereferencing pointer to incomplete type ‘DH’ {aka struct dh_st’} if (!dh->p || !dh->g) { ^~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_pkey_new’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:3589:9: error: dereferencing pointer to incomplete type ‘RSA’ {aka ‘struct rsa_st’} _type->_name = BN_bin2bn(
^~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c:3658:6: note: in expansion of macro ‘OPENSSL_PKEY_SET_BN’ OPENSSL_PKEY_SET_BN(Z_ARRVAL_P(data), rsa, n); ^~~~~~~~~~~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_sign’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:4850:13: error: storage size of ‘md_ctx’ isn’t known EVP_MD_CTX md_ctx; ^~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c:4895:2: warning: implicit declaration of function ‘EVP_MD_CTX_cleanup’; did you mean ‘EVP_MD_CTX_create’? [-Wimplicit-function-declaration] EVP_MD_CTX_cleanup(&md_ctx); ^~~~~~~~~~~~~~~~~~ EVP_MD_CTX_create /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_verify’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:4909:13: error: storage size of ‘md_ctx’ isn’t known EVP_MD_CTX md_ctx; ^~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_seal’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:4974:17: error: storage size of ‘ctx’ isn’t known EVP_CIPHER_CTX ctx; ^~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_open’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:5097:17: error: storage size of ‘ctx’ isn’t known EVP_CIPHER_CTX ctx; ^~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_digest’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:5226:13: error: storage size of ‘md_ctx’ isn’t known EVP_MD_CTX md_ctx; ^~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_encrypt’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:5307:17: error: storage size of ‘cipher_ctx’ isn’t known EVP_CIPHER_CTX cipher_ctx; ^~~~~~~~~~ /usr/local/src/php-7.0.12/ext/openssl/openssl.c: In function ‘zif_openssl_decrypt’: /usr/local/src/php-7.0.12/ext/openssl/openssl.c:5391:17: error: storage size of ‘cipher_ctx’ isn’t known EVP_CIPHER_CTX cipher_ctx; ^~~~~~~~~~ make: *** [Makefile:637: ext/openssl/openssl.lo] Error 1

展开
收起
1635333786023023 2020-05-11 11:40:06 2134 0
1 条回答
写回答
取消 提交回答
  • 【报错1】

    ./configure 时报错

    conftest.c:9:10: fatal error: 'ac_nonexistent.h' file not found

    【解决】

    再次升级到最新的苹果系统 OS Sierra 10.12.1

    【报错2】

    configure: error: Cannot find libz

    【试着解决】

    执行 sudo brew install libz,继续报错:

    【报错3】

    Error: No available formula with the name "libz" ==> Searching for similarly named formulae... These similarly named formulae were found: libzdb libzip libzzip To install one of them, run (for example): brew install libzdb ==> Searching taps... Error: No formulae found in taps. ==> You haven't updated Homebrew in a while. A formula for libz might have been added recently. Run brew update to get the latest Homebrew updates!

    按照提示,执行 brew update,继续报错:

    【报错4】

    /usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory /usr/local/Library/brew.sh: line 32: /usr/local/Library/ENV/scm/git: No such file or directory [etc..] Error: update-report should not be called directly!

    参考国外的网站,homebrew-error-update-report-should-not-be-called-directly

    【解决】

    1 cd /usr/local; git reset --hard origin/master; brew update 继续执行,brew update,继续报错:

    【报错5】

    Error: /usr/local must be writable!

    执行 sudo brew update,继续报错:

    【报错6】

    Error: Cowardly refusing to 'sudo brew update' You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk.

    好吧,修改 /usr/local/ 文件夹的权限(用户)

    sudo chown -R $(whoami) /usr/local

    再次执行 brew update,这条语句没报错!

    继续解决 Cannot find libz 的问题,执行: brew install libz,报错

    【报错7】

    Error: No available formula with the name "libz" ==> Searching for similarly named formulae... These similarly named formulae were found: libzdb libzip libzzip To install one of them, run (for example): brew install libzdb ==> Searching taps... Error: No formulae found in taps.

    后来,找到一个帖子,Cannot find libz when install php56,找到解决方案

    【解决】

    执行

    1 2 xcode-select --install brew upgrade PHP-5.6 继续执行,./configure ,没报错!

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 ./configure
    --prefix=/usr/local/php/php-5.6
    --with-config-file-path=/usr/local/php/php-5.6/etc
    --with-openssl=/usr/local/opt/openssl
    --with-zlib
    --with-bz2
    --with-gd
    --with-jpeg-dir
    --with-png-dir
    --with-gettext
    --with-mhash
    --with-freetype-dir
    --with-mcrypt
    --with-iconv
    --with-curl
    --with-xmlrpc
    --with-mysql
    --with-pdo-mysql
    --with-mysqli
    --enable-calendar
    --enable-pdo
    --enable-zip
    --enable-mbstring
    --enable-mbregex
    --enable-bcmath
    --enable-soap
    --enable-sockets
    --enable-ftp
    --enable-gd-native-ttf
    --enable-shmop
    --enable-sysvmsg
    --enable-sysvsem
    --enable-sysvshm
    --enable-xml
    --enable-pcntl
    --enable-fpm
    --enable-opcache
    --without-pear PHP-7.0

    1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 ./configure
    --prefix=/usr/local/php/php-7.0
    --with-config-file-path=/usr/local/php/php-7.0/etc
    --with-openssl=/usr/local/opt/openssl
    --with-zlib
    --with-bz2
    --with-gd
    --with-jpeg-dir
    --with-png-dir
    --with-gettext
    --with-mhash
    --with-freetype-dir
    --with-mcrypt
    --with-iconv
    --with-curl
    --with-xmlrpc
    --with-pdo-mysql
    --with-mysqli
    --enable-calendar
    --enable-pdo
    --enable-zip
    --enable-mbstring
    --enable-mbregex
    --enable-bcmath
    --enable-soap
    --enable-sockets
    --enable-ftp
    --enable-gd-native-ttf
    --enable-shmop
    --enable-sysvmsg
    --enable-sysvsem
    --enable-sysvshm
    --enable-xml
    --enable-pcntl
    --enable-fpm
    --enable-opcache
    --without-pear 执行 make 的时候会报错,参考 以前的文章,即可解决:

    Mac Pro 编译安装 PHP 5.6.21 及 问题汇总

    执行 make 操作的时候,又报错:

    /usr/lib/libiconv.dylib /usr/local/lib/libiconv.dylib -o sapi/cli/php ld: can't write output file: sapi/cli/php for architecture x86_64

    提示不能写入,应该是权限的问题,进入源码包的,查看文件 ./sapi/cli/php 文件,所属用户为 root,果然是权限问题,执行 make 的时候,sudo 一下,即 sudo make,大功告成

    2021-02-08 10:54:27
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
PHP 2017.北京 全球开发者大会——高可用的PHP 立即下载
PHP安全开发:从白帽角度做安全 立即下载
复杂PHP系统性能瓶颈排查及优化 立即下载