首页 > 未分类 > mac编译nginx lua模块报 ld: symbol(s) not found for architecture x86_64

mac编译nginx lua模块报 ld: symbol(s) not found for architecture x86_64

2017年8月1日 发表评论 阅读评论

mac上源码编译安装nginx lua模块, make时报ld: symbol(s) not found for architecture x86_64错误,

具体为

-Wl,-rpath,/usr/local/openresty/luajit/lib -L/Applications/ngx_openresty-1.4.3.6/build/luajit-root/usr/local/openresty/luajit/lib -lluajit-5.1 -lm -pagezero_size 10000 -image_base 100000000 -lpcre -lssl -lcrypto -lz
Undefined symbols for architecture x86_64:
"_pcre_free_study", referenced from:
_ngx_http_lua_regex_free_study_data in ngx_http_lua_regex.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [objs/nginx] Error 1
make[1]: *** [build] Error 2
make: *** [all] Error 2

百度出的解决方法五花八门,亲自尝试都没解决问题,

找到一篇文章 http://www.mamicode.com/info-detail-1345456.html,发现是查找pcre的问题。

解决方法如下:

# mdfind pcre | grep /usr/local

找到 pcre 所在目录 /usr/local/Cellar/pcre/8.36/

修改nginx编译参数,问题解决

--prefix=/usr/local/nginx --add-module=/usr/local/src/echo-nginx-module --add-module=/usr/local/src/nginx-http-concat --with-http_stub_status_module --with-http_ssl_module --with-pcre --with-debug --with-pcre-jit --add-module=/usr/local/src/ngx_devel_kit-0.3.0 --add-module=/usr/local/src/lua-nginx-module-0.10.9rc8 --with-cc-opt="-I/usr/local/Cellar/pcre/8.36/include" --with-ld-opt="-L/usr/local/Cellar/pcre/8.36/lib"
分类: 未分类 标签:
  1. 本文目前尚无任何评论.
  1. 本文目前尚无任何 trackbacks 和 pingbacks.