pecl install memcached - 在“/opt/homebrew/opt/zlib/include”下找不到ZLIB头文件

3

我已经在使用苹果芯片的Mac上使用Homebrew安装了PHP、zlib和memcached。我正在尝试使用以下命令安装PHP的memcached扩展:

sudo pecl install memcached

当它提示我输入“zlib目录[否]:”时,我指定了“/opt/homebrew/opt/zlib/include”。
我已确认该目录包含文件zlib.h和zconf.h。同时,`brew info zlib`也告诉我这一点。
For compilers to find zlib you may need to set:
  export LDFLAGS="-L/opt/homebrew/opt/zlib/lib"
  export CPPFLAGS="-I/opt/homebrew/opt/zlib/include"

For pkg-config to find zlib you may need to set:
  export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig"

看起来我似乎为zlib提供了正确的路径。然而,运行sudo pecl install memcached时会抛出以下错误:

checking whether to use system FastLZ library... no
checking for ZLIB... yes, shared
checking for pkg-config... /opt/homebrew/bin/pkg-config
configure: error: Can't find ZLIB headers under "/opt/homebrew/opt/zlib/include"
ERROR: `/private/tmp/pear/temp/memcached/configure --with-php-config=/opt/homebrew/opt/php/bin/php-config --with-libmemcached-dir=no --with-zlib-dir=/opt/homebrew/opt/zlib/include --with-system-fastlz=no --enable-memcached-igbinary=no --enable-memcached-msgpack=no --enable-memcached-json=no --enable-memcached-protocol=no --enable-memcached-sasl=no --enable-memcached-session=no' failed

我该如何修复这个问题?


我已经尝试了 "brew reinstall zlib" 和 "export PKG_CONFIG_PATH="/opt/homebrew/opt/zlib/lib/pkgconfig""。 - tinkerr
1个回答

2

我曾经遇到过同样的问题,但最终在 Mac 上使用以下路径解决了它:

/opt/homebrew/opt/zlib

虽然 "/opt/homebrew/opt/zlib/include" 技术上是包含头文件的文件夹,但错误信息却是误导性的。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接