簡體   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