Error on require
rumkin opened this issue · comments
Got error requiring cjson
:
/apps/nginx/lua-cjson/cjson.so:1: unexpected symbol near 'char(127)'
cjson was built with command:
make LUA_INCLUDE_DIR=/usr/include/lua5.2
The error indicates that "cjson.so" is being interpreted as a Lua source file, not a plugin.
I'm not familiar with your nginx configuration, but I suspect the Lua package.path
incorrectly includes the "?.so" file. Eg:
$ lua
Lua 5.2.2 Copyright (C) 1994-2013 Lua.org, PUC-Rio
> package.path = "./?.so"
> require "cjson"
error loading module 'cjson' from file './cjson.so':
./cjson.so:1: unexpected symbol near char(127)
stack traceback:
[C]: in ?
[C]: in function 'require'
stdin:1: in main chunk
[C]: in ?
The path settings can usually be set with LUA_PATH
/LUA_CPATH
environment variables, package.path
/package.cpath
(within Lua), or some custom application configuration (Nginx).
Yep, it works. I've mixed up path
and cpath
. Sorry for that and thanks for answer!
And now I've got )
lua-cjson/cjson.so: undefined symbol: luaL_setfuncs
Solved.