Comments (14)
Hi,
I tried requiring and using several luarocks-installed modules in ngx_lua, including luasocket and luayaml, and found no errors. Could you show us some problematic modules and example scripts?
Thanks!
from lua-nginx-module.
Hi,
Depending on the rocks
i am calling, i got this kind of error :
2011/02/12 11:10:03 [error] 42397#0: *72 content_by_lua aborted: runtime error: /usr/local/share/lua/5.1/luarocks/loader.lua:95: error loading module 'lpeg' from file '/usr/local/lib/luarocks/lib/lua/5.1//lpeg.so':
dlopen(/usr/local/lib/luarocks/lib/lua/5.1//lpeg.so, 2): Symbol not found: _luaL_addlstring
Referenced from: /usr/local/lib/luarocks/lib/lua/5.1//lpeg.so
Expected in: dynamic lookup
, client: 127.0.0.1, server: , request: "GET / HTTP/1.1", host: "localhost:6789"
2011/02/12 11:10:03 [error] 42397#0: *73 content_by_lua aborted: runtime error: /Users/jney/src/test/server.lua:2: loop or previous error loading module 'json', client: 127.0.0.1, server: , request: "GET /favicon.ico HTTP/1.1", host: "localhost:6789"
Or this kind :
2011/02/12 10:51:54 [error] 39866#0: *59 content_by_lua aborted: runtime error: /Users/jney/src/test/server.lua:2: module 'luasocket' not found:
from lua-nginx-module.
Hi,
Rocks luasocket/lpeg/luajson work well with ngx_lua in my environment...Would you please offer the following commands' output?
-
uname -a
-
/path/to/your/nginx/executable -V
-
nm /path/to/your/nginx/executable | grep luaL_
-
ldd /path/to/your/nginx/executable
-
Output of this script in your nginx with ngx_lua:
require("luarocks.require")
ngx.say(package.path)
ngx.say(package.cpath) -
luarocks --version; luarocks path
from lua-nginx-module.
Hi,
Here it is :
-
uname -a
:Darwin hackro 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386 i386
-
nginx -V
nginx version: nginx/0.8.54
TLS SNI support enabled
configure arguments: --prefix=/usr/local/Cellar/nginx/0.8.54 --with-http_ssl_module --with-pcre --conf-path=/usr/local/etc/nginx/nginx.conf --pid-path=/usr/local/var/run/nginx.pid --lock-path=/usr/local/var/nginx/nginx.lock --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_realip_module --with-http_gzip_static_module --with-http_geoip_module --add-module=/Users/jney/src/nginx/ngx_devel_kit/ --add-module=/Users/jney/src/nginx/lua-nginx-module/ --add-module=/Users/jney/src/nginx/redis2-nginx-module/ --add-module=/Users/jney/src/nginx/encrypted-session-nginx-module/ -
nm $(which nginx) | grep luaL_
zsh: done nm $(which nginx) |
zsh: exit 1 grep --color=auto luaL_ -
otool -L $(which nginx)
/usr/local/sbin/nginx:
/usr/lib/libcrypto.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
/usr/lib/libssl.0.9.8.dylib (compatibility version 0.9.8, current version 0.9.8)
/usr/lib/libpcre.0.dylib (compatibility version 1.0.0, current version 1.1.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
/usr/local/Cellar/geoip/1.4.6/lib/libGeoIP.1.dylib (compatibility version 6.0.0, current version 6.6.0) -
require("luarocks.require") ngx.say(package.path) ngx.say(package.cpath)
package.path :
/usr/local/lib/luarocks/share/lua/5.1//?.lua;/usr/local/lib/luarocks/share/lua/5.1//?/init.lua;/.luarocks/share/lua/5.1//?.lua;/.luarocks/share/lua/5.1//?/init.lua;./?.lua;/usr/local/share/lua/5.1/?.lua;/usr/local/share/lua/5.1/?/init.lua;/usr/local/lib/lua/5.1/?.lua;/usr/local/lib/lua/5.1/?/init.lua
package.cpath :
/usr/local/lib/luarocks/lib/lua/5.1//?.so;/.luarocks/lib/lua/5.1//?.so;./?.so;/usr/local/lib/lua/5.1/?.so;/usr/local/lib/lua/5.1/loadall.so -
luarocks --version
luarocks 2.0.2
LuaRocks main command-line interface
I don't know how to get luarocks path
, but i think it is /usr/local/lib/luarocks
Plus, when i require a rocks in a script with lua installed binary, it works. so i tried to set lua_package_path
and lua_package_cpath
to what i got on my system, getting them with package.path
and package.cpath
. but it doesn't work.
Thank you for the support.
from lua-nginx-module.
Hi,
It's weird that your nginx executable doesn't export any luaL_* symbols. What about the standard lua executable? Would you run the nm cmdline on it again and paste its output?
Besides, the strace output of nginx is also helpful. Please run:
strace -o strace.log /path/to/your/nginx/executable
Access the problematic script, then interrupt strace and send both strace.log and the script itself to me.
Thanks
from lua-nginx-module.
Here it is :
sudo dtruss $(which nginx) 2>&1 | tee ./trace.log > /dev/null
and acceed to the problematic page (containing the script) the output is there : https://gist.github.com/826555nm $(which nginx) > nginx.nm.out
the output is there : https://gist.github.com/826561
from lua-nginx-module.
Sorry, I mean the output of nm $(which lua)
. Besides, would you add -f option to dtruss in order to trace all the child processes, like sudo dtruss -a -f -l $(which nginx) 2>&1 | tee ./trace.log > /dev/null
?
from lua-nginx-module.
Here it is :
nm $(which lua) > lua.out
: https://gist.github.com/828229sudo dtruss -a -f -l $(which nginx) 2>&1 | tee ./trace.log > /dev/null
: https://gist.github.com/828241
from lua-nginx-module.
It seems that nginx executable doesn't export lua related symbols, so lua c-modules doesn't work. On Linux there's -E linking options to do executable symbols exporting, I don't know if OSX has some linking options with similar behavior. Could you search your linker's document to find some hints?
from lua-nginx-module.
You compiled nginx with homebrew interactive shell, right? I tried this way under OSX, and found that homebrew strangely disabled all exported symbols from installed nginx executable file. The exported symbols are correct both in the building directory AND installed directory, as long as we are in homebrew interactive shell. We have to find out what had it done after building shell exited.
from lua-nginx-module.
OK...homebrew just stripped debug symbols out of nginx executables, normally this should be okay. But it seems that lpeg could not work in such a environment, we have to dig out reason from lpeg...
from lua-nginx-module.
Sorry, the problem is related to luarocks, not lpeg. We'll find out how to solve it....
from lua-nginx-module.
Sorry for the delay but I just tried and could not reproduce this issue on Mac OS X 10.6.8 using the standard nginx tarball and plain gcc (shipped by Xcode).
How exactly did you build your nginx/ngx_lua? Have you stripped dynamic symbols from your nginx executable?
Can you try out the ngx_openresty bundle to see if it works with your LuaRocks modules? http://openresty.org/#Download
from lua-nginx-module.
Consider it resolved.
from lua-nginx-module.
Related Issues (20)
- conditional shm get, eagain HOT 3
- Aborting Nginx reload on condition HOT 1
- 500 Internal Server Error HOT 1
- ngx.say not work
- init_by_lua during Nginx config test HOT 3
- Using outer scope required modules inside an ngx.timer.at handler HOT 4
- when header_filter_by_lua_file run failed. HOT 1
- OpenResty keepalive connection appears to be hung HOT 6
- unexpected phase error when `ngx.send_header()` trigger `if_unmodified` 412 logic HOT 2
- nginx: [emerg] dlopen() "/etc/nginx/ngx_http_naxsi_module.so" failed (/etc/nginx/ngx_http_naxsi_module.so: undefined symbol: pcre_exec) in /etc/nginx/nginx.conf:9 nginx: configuration file /etc/nginx/nginx.conf test failed
- nginx: [emerg] dlopen() "/usr/local/src/nginx-1.26.1/objs/ngx_http_naxsi_module.so" failed (/usr/local/src/nginx-1.26.1/objs/ngx_http_naxsi_module.so: undefined symbol: pcre_exec) in /etc/nginx/nginx.conf:9 HOT 2
- Nginx + LibreSSL (undefined symbol: SSL_client_hello_get0_ext) HOT 3
- Possible to support `tcpsock:receive` in `balancer_by_lua` context?
- `ngx.req.set_body_data` API does not work in `balancer_by_lua` phase HOT 1
- errlog get_logs doesnt get error logs in privileged agent and visa versa HOT 3
- Core dumps with Lua nginx module and OCSP enabled on ingress-nginx HOT 2
- attempt to redefine .. in cdef HOT 1
- New module release HOT 2
- bug: memory leak when collecting response body chunks HOT 1
- ngx_http_lua_module 0.10.27 HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lua-nginx-module.