问题 Nginx在Mac OS X Lion上安装。找不到PCRE


首先,我正在尝试编译所有源代码,我不使用MacPorts或HomeBrew。

我已经安装了pcre /usr/local/pcre-8.21 并将此符号链接到 /usr/local/pcre

我已经设定 /usr/local/pcre/bin 对我的 PATH 变量在这里。

`/usr/local:/usr/local/mysql/bin:/usr/local/pcre/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin`

我现在正在尝试安装Nginx,但我不断收到此消息:

./configure: error: the HTTP rewrite module requires the PCRE library. You can either disable the module by using --without-http_rewrite_module option, or install the PCRE library into the system, or build the PCRE library statically from the source with nginx by using --with-pcre=<path> option.

我尝试过设置 --with-pcre=/usr/local/pcre/bin 但它只是试图重新安装PCRE。

任何人都可以帮我解决这个问题吗? 谢谢。


13171
2018-01-22 17:45


起源

你有没有试过--with-pcre = / usr / local / pcre(BTW这就是为什么人们使用macports / Homebrew来避免这种问题的追逐) - Mark
如果我为PCRE添加一个路径,它将创建一个Makefile,但是当你运行make时它会在尝试查找pcre makefile时抛出一个错误。 (在Linux上我完全适用于软件包管理器,但在Mac上我发现它们混乱且不可靠。但是,是的,它们让生活更轻松) - steveYeah
听起来像pcre没有正确安装它的include和lib文件在哪里? - Mark
所有文件和目录都安装在 /usr/local/pcre-8.21。 /usr/local/pcre 是此目录的符号链接。 - steveYeah
如果有帮助,这些是它在运行configure时抛出的特定错误: checking for PCRE library ... not found checking for PCRE library in /usr/local/ ... not found checking for PCRE library in /usr/include/pcre/ ... not found checking for PCRE library in /usr/pkg/ ... not found checking for PCRE library in /opt/local/ ... not found - steveYeah


答案:


Nginx需要PCRE - Perl兼容正则表达式(http://www.pcre.org/

下载PCRE并安装PCRE:

cd pcre-8.01
./configure --prefix=/usr/local
make
sudo make install

在nginx文件夹中输入要安装:

cd nginx-0.8.33
./configure --prefix=/usr/local --with-http_ssl_module
make
sudo make install

10
2018-06-10 23:31





答案可能已经找到,但我仍想补充我的答案。 当你使用./configure时,你应该使用--with-pcre = / path / to / pcre / source。所以假设源代码保存在/ usr / local / src / pcre中,那么命令将如下所示:

./configure --with-pcre=/usr/local/src/pcre

希望这有助于某人!


2
2018-03-25 10:41



是的,这个问题已经添加了。最后我想我删除了我的PCRE安装并允许它在安装Nginx时重新安装它 - steveYeah


我遇到了同样的问题。这些命令解决了我的问题:

打开MAC终端并运行以下命令:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

然后运行:

brew install pcre

完成!

资源: http://macappstore.org/pcre-2/


0
2017-11-02 07:14