When building OpenResty (the excellent Lua add-on for nginx) on OS/X I got the following error: nginx
Undefined symbols for architecture x86_64: "_pcre_free_study", referenced from: _ngx_pcre_free_studies in ngx_regex.o _ngx_http_lua_ngx_re_match in ngx_http_lua_regex.o _ngx_http_lua_ngx_re_gmatch in ngx_http_lua_regex.o _ngx_http_lua_ngx_re_sub_helper in ngx_http_lua_regex.o _ngx_http_lua_ngx_re_gmatch_cleanup in ngx_http_lua_regex.o _ngx_http_lua_ngx_re_gmatch_gc in ngx_http_lua_regex.o _ngx_http_lua_ngx_re_gmatch_iterator in ngx_http_lua_regex.o ... ld: symbol(s) not found for architecture x86_64
To cut a long story short, download the latest version of pcre (PCRE – Perl Compatible Regular Expressions) from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/, extract it to a directory, say /Users/me/pcre-8.21/ and then from the ngx-openresty source directory run configure with: ui
./configure --with-luajit --with-pcre=/Users/me/pcre-8.21/
all will be well… lua
—– update from Sept 2013: rest
I realised that perhaps a better way to install PCRE would be to install homebrew on your Mac and then just: excel
brew install pcre
however, you will need to know where homebrew installed pcre as you will need to add that parameter when running configure. There are several ways of locating a file on the Mac (I’ll refer to the command line only. The grep is since I know it is installed somewhere in /usr/local): code
mdfind pcre | grep usr/local
sudo /usr/libexec/locate.updatedb
and then homebrew
locate pcre | grep usr/local
find /usr/local -name pcre -print
in my case the location was /usr/local/Cellar/pcre/8.33/ so the configure parameters were: get
./configure --with-luajit \ --with-cc-opt="-I/usr/local/Cellar/pcre/8.33/include" \ --with-ld-opt="-L/usr/local/Cellar/pcre/8.33/lib"