-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
链接LuaJIT-2.0.2的静态库报错,需要在./bundle/ngx_lua-0.9.2/config中加入-ldl参数 #40
Comments
You don't need to edit ngx_lua's BTW, this place is supposed to be English only. If you really want to use Chinese, please join the openresty (Chinese) mailing list and post there instead: https://groups.google.com/group/openresty Thank you for your cooperation! |
I passed the `--with-ld-opt="-ldl" to openresty's ./configure and got the same error.
I put and it works. |
Oh right. the order matters. I'll look into this. Thanks for the feedback. |
…ker. thanks cf2012 for the report in openresty/openresty#40.
@cf2012 Just committed a fix to the git master branch of ngx_lua. Thank you for the report and sorry for the delay on my side! |
@cf2012 能帮看一下这个问题吗? #include <lauxlib.h> int main(void) { error unsupported Lua language version#endif /bin/sh -c cl -I/usr/local/include/luajit-2.0 -W3 -DFD_SETSIZE=1024 -I /usr/local/include/luajit-2.0 -o objs/autotest objs/autotest.c -L/usr/local/lib -L/usr/local/lib -llua51 >> objs/autoconf.err 2>&1 |
@ai930 Please, no Chinese here. This place is considered English only. If you really Also, please do not hijack and comment on unrelated github issues, especially this closed one. This is rude. |
程序版本: ngx_openresty-1.4.3.4
操作系统: Ubuntu 12.04.1 LTS
编译器版本: gcc (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
Luajit版本: LuaJIT-2.0.2
编译时, 我想用静态库: libluajit-5.1.a
所以将 $LuaJIT_HOME/lib 下的_.so_全删了.
然后执行:
./configure --prefix=
pwd
--with-luajit=/opt/LuaJIT-2.0.2报错:
./configure: error: ngx_http_lua_module requires the Lua or LuaJIT library and LUAJIT_LIB is defined as /opt/LuaJIT-2.0.2/lib and LUAJIT_INC (path for lua.h) /opt/LuaJIT-2.0.2/include/luajit-2.0, but we cannot find LuaJIT there.
在bundle/nginx-1.4.3/auto/feature的47行之后添加:
cat $NGX_AUTOTEST.c
echo "/bin/sh -c "$ngx_test" >> $NGX_AUTOCONF_ERR 2>&1"
调试发现真正的报错信息为:
/opt/LuaJIT-2.0.2/lib/libluajit-5.1.a(lj_clib.o): In function
clib_getsym': /run/shm/ngx_openresty-1.4.3.4/build/LuaJIT-2.0.2/src/lj_clib.c:140: undefined reference to
dlsym'/opt/LuaJIT-2.0.2/lib/libluajit-5.1.a(lj_clib.o): In function
clib_loadlib': /run/shm/ngx_openresty-1.4.3.4/build/LuaJIT-2.0.2/src/lj_clib.c:117: undefined reference to
dlopen'LuaJIT-2.0.2/lib/pkgconfig/luajit.pc 中:
Requires:
Libs: -L${libdir} -l${libname}
Libs.private: -Wl,-E -lm -ldl
链接阶段用静态库的话, 需要在gcc加 -ldl 参数..
修改./bundle/ngx_lua-0.9.2/config, 添加 -ldl 参数后编译成功. :-)
The text was updated successfully, but these errors were encountered: