I was trying to install Phusion Passenger and nginx on Mac OS X 10.8.2, using the Passenger installer for nginx, and kept running into this error:
[size=1em]$ passenger-install-nginx-module
...
Undefined symbols [size=1em]for architecture x86_64:
[size=1em]"_pcre_free_study", referenced from:
_ngx_pcre_free_studies in ngx_regex.o
ld: symbol[size=1em](s[size=1em]) not found [size=1em]for architecture x86_64
collect2: ld returned 1 [size=1em]exit status
make[size=1em][1[size=1em]]: *** [size=1em][objs/nginx[size=1em]] Error 1
make: *** [size=1em][build[size=1em]] Error 2
The Googles turned up a blog post from Phusion about what appeared to be the same problem. Applying their suggested fix (downloading pcre.h and copying it to /usr/include) didn’t help, unfortunately.
I happened to stumble across a Github issue about a different nginx module that provided a tantalizing hint:
[size=1em]If the problem persists, please check that if you have multiple versions of PCRE installed in your system.
There was a version of pcre installed via Homebrew already on my system. I had apparently installed it for something I had since uninstalled, because I was able to remove it without complaint. Running the Passenger installer for nginx this time was more successful:
[size=1em]$ passenger-install-nginx-module
...
PCRE [size=1em](required by Nginx[size=1em]) not installed, downloading it...
...
Nginx with Passenger support was successfully installed.
It looks like pcre installed via Homebrew confuses the Passenger installer; removing pcre allows the installer to download all the pieces it needs to a place it can find them.
Now, to see how it runs.
====================================
1、gem install passenger
2、passenger-install-nginx-module
Compiling and installing Nginx...
# sh ./configure --prefix='/opt/nginx' --with-http_ssl_module --with-http_gzip_static_module --with-cc-opt='-Wno-error' --add-module='/Users/xxxx/.rvm/gems/ruby-1.9.3-p374/gems/passenger-3.0.17/ext/nginx' --with-pcre='/Users/xxxx/Downloads/packages/pcre-8.32'