fabled / lua-maxminddb

libmaxminddb bindings for lua
MIT License
8 stars 15 forks source link

cannot get to work using nginx 1.9.4 #1

Open MarkBlah opened 8 years ago

MarkBlah commented 8 years ago

Hello, thanks for spending the time in writing this,

I'm getting the following error:

2016/05/22 21:33:16 [error] 27095#0: *3 lua entry thread aborted: runtime error: error loading module 'lua/maxminddb' from file '/usr/share/nginx/lualib/lua/maxminddb.so': /usr/share/nginx/lualib/lua/maxminddb.so: undefined symbol: luaL_setfuncs stack traceback: coroutine 0: [C]: in function 'require' content_by_lua(nginx.conf:84):2: in function <content_by_lua(nginx.conf:84):1>, client: x.x.x.x, server: localhost, request: "GET /test HTTP/1.1",

I've tried compiling with both 5.1 and 5.2 in make file with same result

Let me know your thoughts

fabled commented 8 years ago

Sounds like it's picking the #include headers from wrong lua version. Did you pass LUA_PKG and/or LUA_CFLAGS/LUA_CMOD at build time?

MarkBlah commented 8 years ago

yes, my bad :) very cool! got it working perfectly with lua5.1!

I am trying to get it loaded using nginx+lua (openresty), getting the following error message:

2016/05/24 15:05:00 [error] 18855#0: *5167 lua entry thread aborted: runtime error: error loading module 'maxminddb' from file '/usr/share/nginx/lualib/maxminddb.so': /usr/share/nginx/lualib/maxminddb.so: undefined symbol: luaopen_maxminddb stack traceback: coroutine 0: [C]: in function 'require' content_by_lua(nginx.conf:91):2: in function <content_by_lua(nginx.conf:91):1>, client: x.x.x.x, server: localhost, request: "GET /test HTTP/1.1", host: "x.x.x.x"

has me stumped, if i find the solution i'll share

fabled commented 8 years ago

What is the full CFLAGS/LDFLAGS you are using? The function is defined, but perhaps it is removed by linker if --as-needed was added somewhere. Perhaps adding -Wl,--no-as-needed to LDFLAGS fixes it?

Alternatively could you attach the broken .so, or nm -D dump of it?