在带有 brew 的 mac 上安装 amqp

2022-08-30 17:58:29

我想为我的Mac sierra安装pecl。amqp

我用brew安装了php,我收到一个错误:pecl install amqpchecking for amqp using pkg-config... configure: error: librabbitmq not found

我安装了 brew 软件包,但我仍然收到此错误。我认为它不知何故没有与pkg-config同步。librabbitmq-c

有人知道在这里做什么吗?


答案 1

首先安装 rabbitmq-c 与 brew:

brew search librabbitmq
No formula or cask found for "librabbitmq".
Closed pull requests:
Add rabbitmq-c (aka librabbitmq) formula (https://github.com/Homebrew/legacy-homebrew/pull/13437)


brew install rabbitmq-c

然后用 pecl 安装 amqp:

pecl install amqp

将路径设置为 librabbitmq:

Set the path to librabbitmq install prefix [autodetect] : /usr/local/Cellar/rabbitmq-c/0.9.0

验证现在是否安装了 amqp:

php -i|grep amqp

答案 2

问题在于 pkg-config 无法为 librabbitmq 生成 libs/cflags。

$ pkg-config librabbitmq --cflags
Package openssl was not found in the pkg-config search path.
Perhaps you should add the directory containing `openssl.pc'
to the PKG_CONFIG_PATH environment variable
Package 'openssl', required by 'librabbitmq', not found

我所做的是将 rabbitmq-copenssl 都添加到 $PKG_CONFIG_PATH 中,如下所示:

export PKG_CONFIG_PATH="/usr/local/Cellar/rabbitmq-c/0.10.0/lib/pkgconfig:/usr/local/opt/openssl@1.1/lib/pkgconfig"

然后,生成将成功。(注意:我用phpbrew而不是pecl构建了我的,但应该可以工作)。


推荐