mac下brew install php后用pecl安装swoole报错找不到pcre2.h
In file included from /private/tmp/pear/temp/swoole/ext-src/php_swoole.cc:21:
/usr/local/Cellar/php/8.0.0_1/include/php/ext/pcre/php_pcre.h:23:10: fatal error: 'pcre2.h' file not found
#include "pcre2.h"
^~~~~~~~~
1 error generated.
make: *** [ext-src/php_swoole.lo] Error 1
ERROR: `make' failed
解决办法:
定义一个软连接到对应位置就可以了,如下:
ln -s /usr/local/Cellar/pcre2/10.37_1/include/pcre2.h /usr/local/Cellar/php/8.0.10/include/php/ext/pcre/pcre2.h
在Mac环境下使用Homebrew安装PHP后,尝试通过PECL安装Swoole扩展时出现错误,找不到pcre2.h文件。解决方法是创建一个软链接,将pcre2.h从其实际位置链接到PHP的pcre目录。具体操作为:`ln -s /usr/local/Cellar/pcre2/10.37_1/include/pcre2.h /usr/local/Cellar/php/8.0.10/include/php/ext/pcre/pcre2.h`。完成此步骤后,编译安装过程应能正常进行。

1412

被折叠的 条评论
为什么被折叠?



