2012-01-22 161 views
10

首先,我試圖編譯源代碼的所有內容,我沒有使用MacPorts或HomeBrew。Nginx安裝在Mac OS X Lion上。找不到PCRE

我已經安裝了pcre到/usr/local/pcre-8.21,並將其符號鏈接到/usr/local/pcre

我已經設置/usr/local/pcre/binPATH變量在這裏。

`/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。

誰能幫我避開這個問題? 謝謝。

+2

你試過--with-PCRE =在/ usr /本地/ PCRE(順便說一句,這就是爲什麼人們使用的MacPorts /家釀避免的問題,這個追逐) – Mark

+0

如果我添加一個路徑PCRE它會創建一個Makefile,但是當你運行make時它會嘗試查找pcre makefile時引發錯誤。 (在Linux上我所有的軟件包管理器,但在Mac上我發現他們混亂和不可靠,但是,他們讓生活變得更容易) – steveYeah

+0

聲音像pcre沒有正確安裝它的include和lib文件的位置? – Mark

回答

10

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 
2

答案可能已經被發現,但我仍然想要添加我的答案。 當你使用./configure時,你應該使用--with-pcre =/path/to/pcre/source。所以我們說的源代碼保存在/ usr/local/src目錄/ PCRE則命令將是這樣的:

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

希望這可以幫助別人!

+0

是的,這是在問題中添加的。最後,我想我刪除了PCRE的安裝,並允許它在安裝Nginx時重新安裝它 – steveYeah

0

我面臨同樣的問題。這些命令解決我的問題:

打開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/