繁体   English   中英

MacOS 上 php 7.4 的 Pecl 扩展编译错误

[英]Pecl extension compile error for php 7.4 on MacOS

我正在尝试在最新的 Mac OS 上为 php 7.4 安装 pecl mongodb 和 memcached 扩展。

得到同样的错误:

pecl install memcached
...
creating libtool
appending configuration tag "CXX" to libtool
configure: patching config.h.in
configure: creating ./config.status
config.status: creating config.h
running: make
/bin/sh /private/tmp/pear/temp/pear-build-timurbYTemI/memcached-3.1.5/libtool --mode=compile cc -I/usr/local/Cellar/php/7.4.11/include/php    -I. -I/private/tmp/pear/temp/memcached -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-timurbYTemI/memcached-3.1.5/include -I/private/tmp/pear/temp/pear-build-timurbYTemI/memcached-3.1.5/main -I/private/tmp/pear/temp/memcached -I/usr/local/Cellar/php/7.4.11/include/php -I/usr/local/Cellar/php/7.4.11/include/php/main -I/usr/local/Cellar/php/7.4.11/include/php/TSRM -I/usr/local/Cellar/php/7.4.11/include/php/Zend -I/usr/local/Cellar/php/7.4.11/include/php/ext -I/usr/local/Cellar/php/7.4.11/include/php/ext/date/lib -I/usr/local/opt/zlib/include -I/usr/local/Cellar/libmemcached/1.0.18_2/include  -I/usr/local/opt/php@7.4/include -DHAVE_CONFIG_H  -g -O2 -I/usr/local/Cellar/php/7.4.11/include/php -I/usr/local/Cellar/php/7.4.11/include/php/main -I/usr/local/Cellar/php/7.4.11/include/php/TSRM -I/usr/local/Cellar/php/7.4.11/include/php/Zend -I/usr/local/Cellar/php/7.4.11/inclu
de/php/ext -I/usr/local/Cellar/php/7.4.11/include/php/ext/date/lib -I/usr/local/opt/zlib/include -I/usr/local/Cellar/libmemcached/1.0.18_2/include   -c /private/tmp/pear/temp/memcached/php_memcached.c -o php_memcached.lo
mkdir .libs
 cc -I/usr/local/Cellar/php/7.4.11/include/php -I. -I/private/tmp/pear/temp/memcached -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-timurbYTemI/memcached-3.1.5/include -I/private/tmp/pear/temp/pear-build-timurbYTemI/memcached-3.1.5/main -I/private/tmp/pear/temp/memcached -I/usr/local/Cellar/php/7.4.11/include/php -I/usr/local/Cellar/php/7.4.11/include/php/main -I/usr/local/Cellar/php/7.4.11/include/php/TSRM -I/usr/local/Cellar/php/7.4.11/include/php/Zend -I/usr/local/Cellar/php/7.4.11/include/php/ext -I/usr/local/Cellar/php/7.4.11/include/php/ext/date/lib -I/usr/local/opt/zlib/include -I/usr/local/Cellar/libmemcached/1.0.18_2/include -I/usr/local/opt/php@7.4/include -DHAVE_CONFIG_H -g -O2 -I/usr/local/Cellar/php/7.4.11/include/php -I/usr/local/Cellar/php/7.4.11/include/php/main -I/usr/local/Cellar/php/7.4.11/include/php/TSRM -I/usr/local/Cellar/php/7.4.11/include/php/Zend -I/usr/local/Cellar/php/7.4.11/include/php/ext -I/usr/local/Cellar/php/7.4.11/include/php/ext/date/lib -I/usr/local/opt/zlib/include
-I/usr/local/Cellar/libmemcached/1.0.18_2/include -c /private/tmp/pear/temp/memcached/php_memcached.c  -fno-common -DPIC -o .libs/php_memcached.o
In file included from /private/tmp/pear/temp/memcached/php_memcached.c:22:
In file included from /private/tmp/pear/temp/memcached/php_memcached.h:20:
In file included from /usr/local/Cellar/php/7.4.11/include/php/main/php.h:33:
In file included from /usr/local/Cellar/php/7.4.11/include/php/Zend/zend.h:356:
/usr/local/Cellar/php/7.4.11/include/php/Zend/zend_operators.h:523:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/usr/local/Cellar/php/7.4.11/include/php/Zend/zend_operators.h:586:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/usr/local/Cellar/php/7.4.11/include/php/Zend/zend_operators.h:656:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/usr/local/Cellar/php/7.4.11/include/php/Zend/zend_operators.h:766:10: error: 'asm goto' constructs are not supported yet
        __asm__ goto(
                ^
/private/tmp/pear/temp/memcached/php_memcached.c:482:6: warning: 'sasl_client_init' is deprecated: first deprecated in macOS 10.11 [-Wdeprecated-declarations]
        if (sasl_client_init(NULL) != SASL_OK) {
            ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sasl/sasl.h:924:17: note: 'sasl_client_init' has been explicitly marked deprecated here
LIBSASL_API int sasl_client_init(const sasl_callback_t *callbacks) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_11,__IPHONE_NA,__IPHONE_NA);
                ^
/private/tmp/pear/temp/memcached/php_memcached.c:4631:3: warning: 'sasl_done' is deprecated: first deprecated in macOS 10.11 [-Wdeprecated-declarations]
                sasl_done();
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sasl/sasl.h:727:18: note: 'sasl_done' has been explicitly marked deprecated here
LIBSASL_API void sasl_done(void) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0,__MAC_10_11,__IPHONE_NA,__IPHONE_NA);
                 ^
2 warnings and 4 errors generated.
make: *** [php_memcached.lo] Error 1
ERROR: `make' failed

这是编译器(clang!?)版本的东西吗? 它适用于 php 7.2。 但是对于 php 7.3 和 7.4。 发生同样的错误。

为 Xcode 12 安装命令行工具对我有用。 它将 Clang 更新到 12 版本。

另一个技巧是通过在/usr/local/Cellar/php/7.4.11/include/php/Zend/zend_operators.h:508设置# define ZEND_USE_ASM_ARITHMETIC 0来禁用 asm goto 操作符

禁用 asm goto 操作符技巧对我有用,顺便说一下,我使用的是 PHP 7.4.12。 我不得不将下面的第一行从 1 更改为 0:

# define ZEND_USE_ASM_ARITHMETIC 0 
#else
# define ZEND_USE_ASM_ARITHMETIC 0
#endif

您可以尝试在此处安装适用于 XCode 12 的命令行工具。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM