在macOS上安装xdebug时发生ZEND_LONG_FMT错误

时间:2020-10-13 10:17:19

标签: php macos xdebug

在我的Mac上尝试为xdebug安装php 7.4时,pecl install xdebug在make时出现此错误:

cc -I. -I/private/tmp/pear/temp/xdebug -DPHP_ATOM_INC -I/private/tmp/pear/temp/pear-build-dlrJPgTEe/xdebug-2.9.8/include -I/private/tmp/pear/temp/pear-build-dlrJPgTEe/xdebug-2.9.8/main -I/private/tmp/pear/temp/xdebug -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/private/tmp/pear/temp/xdebug/src -I/private/tmp/pear/temp/pear-build-dlrJPgTEe/xdebug-2.9.8/src -DHAVE_CONFIG_H -g -O2 -c /private/tmp/pear/temp/xdebug/src/base/base.c  -fno-common -DPIC -o src/base/.libs/base.o/private/tmp/pear/temp/xdebug/src/base/base.c:325:83: error: expected ')'
                zend_throw_exception_ex(zend_ce_error, 0, "Maximum function nesting level of '" ZEND_LONG_FMT "' reached, aborting!", XINI_BASE(max_nesting_level));
                                                                                                ^
/usr/local/Cellar/php/7.4.11/include/php/Zend/zend_long.h:57:28: note: expanded from macro 'ZEND_LONG_FMT'
# define ZEND_LONG_FMT "%" PRId64

我的php和macos版本是:

PHP 7.4.11 (cli) (built: Oct  1 2020 23:30:54) ( NTS )
System Version: macOS 10.15.7 (19H2)      
Kernel Version: Darwin 19.6.0

我在另一台具有相同版本的php和macos的计算机上执行了相同的操作,但是从未出现此错误。

据我所知,问题似乎出在ZEND_LONG_FMT宏上,但我不知道为什么这会在特定计算机上发生。

我还遵循了here上的说明,但是发生了相同的错误。

我看过xdebug螳螂和zend bug跟踪器,但没有发现任何相关内容。

有人可以帮助我吗? 谢谢 大卫

1 个答案:

答案 0 :(得分:0)

FWIW,也有一个Xdebug票证:https://bugs.xdebug.org/view.php?id=1876,但是到目前为止,我对为什么会发生这种情况感到困惑。 ZEND_LONG_FMT宏通过inttypes.h头文件使用操作系统应定义的PRId64宏。

就我而言(在Linux上),它位于/usr/include/inttypes.h中,为:

#  define __PRI64_PREFIX    "ll"
...

# define PRId64     __PRI64_PREFIX "d"

我从调试文件中看到,我的用户提供了包含文件/usr/local/include/inttypes.h的信息。由于我没有Mac,因此无法检查该文件。

但是,其他人指出/usr/local/include/inttypes.h文件在他们的OSX上甚至不存在,而应该是 改为/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/inttypes.h

/usr/local/include/inttypes.h可能来自一个奇怪的来源并将事情搞砸了吗?

无论如何,我都不认为这不是Xdebug(或PHP)中的错误,而是OSX上某个损坏的标头。