标题:nginx模块LuaJIT编译安装问题解决 出处:沧海一粟 时间:Mon, 15 Jul 2013 14:06:24 +0000 作者:jed 地址:http://www.dzhope.com/post/978/ 内容: 环境: nginx-1.2.7.tar.gz LuaJIT-2.0.1.tar.gz 按照正常流程对LuaJIT-2.0.1.tar.gz编译,make;make install 编译nginx export LUAJIT_LIB=/usr/local/lib export LUAJIT_INC=/usr/local/include/luajit-2.0 ./configure --prefix=/usr/local/nginx --add-module=exp/lua-nginx-module/ 其他模块参数略 此时会报告错误 checking for LuaJIT library in /usr/local/lib and /usr/local/include/luajit-2.0 (specified by the LUAJIT_LIB and LUAJIT_INC env) ... not found ./configure: error: the ngx_lua addon requires the lua or luajit library and LUAJIT_LIB is defined as /usr/local/lib and LUAJIT_INC /usr/local/include/luajit-2.0, but we cannot find LuaJIT there. 但是查看相应目录及文件都存在,对错误细节内容追踪,在 objs/autoconf.err 中包含 >> ---------------------------------------- >> checking for LuaJIT library in /usr/local/lib and >> /usr/local/include/luajit-2.0 (specified by the LUAJIT_LIB and LUAJIT_INC >> env) >> >> /usr/local/lib/libluajit-5.1.a(lj_clib.o): In function `lj_clib_unload': >> lj_clib.c:(.text+0x9d): undefined reference to `dlclose' >> /usr/local/lib/libluajit-5.1.a(lj_clib.o): In function `clib_error_': >> lj_clib.c:(.text+0xb5): undefined reference to `dlerror' >> /usr/local/lib/libluajit-5.1.a(lj_clib.o): In function `lj_clib_load': >> lj_clib.c:(.text+0x1bf): undefined reference to `dlopen' >> lj_clib.c:(.text+0x214): undefined reference to `dlerror' >> lj_clib.c:(.text+0x2ec): undefined reference to `dlopen' >> lj_clib.c:(.text+0x2fd): undefined reference to `dlerror' >> /usr/local/lib/libluajit-5.1.a(lj_clib.o): In function `lj_clib_index': >> lj_clib.c:(.text+0x47e): undefined reference to `dlsym' >> collect2: ld 返回 1 通过该提示,可以在 configure 后追加 --with-ld-opt=-ldl 解决编译问题,并能顺利通过,但是不建议自己指定-ldl选项,因为会导致其他问题。 那能否不指定这个选择,顺利完成编译呢? 通过对LuaJIT编译过程分析,发现LuaJIT在编译中未找到ldconfig,分析为此原因导致 编辑 Makefile文件,找到ldconfig位置(75行) 原内容是:LDCONFIG= ldconfig -n 修改为:LDCONFIG= /sbin/ldconfig -n 然后对LuaJIT重新make install 此时再编译nginx,一切顺利 Generated by Bo-blog 2.1.1 Release