mpx / lua-cjson

Lua CJSON is a fast JSON encoding/parsing module for Lua
https://kyne.au/~mark/software/lua-cjson.php
MIT License
924 stars 474 forks source link

error loading module 'cjson' #45

Closed kelvin7feng closed 7 years ago

kelvin7feng commented 7 years ago

The problem occurs when I required the 'cjson'. Environment: Mac OS X 10.11.6, lua 5.3

error loading module 'cjson' from file '/usr/local/lib/lua/5.3/cjson.so': dlopen(/usr/local/lib/lua/5.3/cjson.so, 6): Symbol not found: _lua_insert Referenced from: /usr/local/lib/lua/5.3/cjson.so Expected in: flat namespace in /usr/local/lib/lua/5.3/cjson.so

What's wrong with it?

BreaGaudioso commented 7 years ago

Did you ever find a solution to this?

ktalebian commented 6 years ago

@kelvin7feng did you ever find the solution to this?

meetme2meat commented 6 years ago

@ktalebian @BreaGaudioso For time being just used any version other than 2.1.0.6-1

dauuricus commented 3 years ago

i have a problem. this case Arm cpu , android ,termux , lua5.3

using with lua-requests

u0_a185@localhost ~/luatest> luarocks install lua-cjson STDCPP_LIBDIR=/system/lib/
Installing https://luarocks.org/lua-cjson-2.1.0.6-1.src.rock

gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c lua_cjson.c -o lua_cjson.o
lua_cjson.c:743:19: warning: implicit declaration of function 'lua_objlen' is invalid in C99 [-Wimplicit-function-declaration]
            len = lua_objlen(l, -1);
                  ^
1 warning generated.
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c strbuf.c -o strbuf.o
gcc -O2 -fPIC -I/data/data/com.termux/files/usr/include/lua5.3 -c fpconv.c -o fpconv.o
gcc -shared -o cjson.so lua_cjson.o strbuf.o fpconv.o
lua-cjson 2.1.0.6-1 is now installed in /data/data/com.termux/files/home/luatest/./lua_modules (license: MIT)

Missing dependencies for http 0.4-0:
   cqueues >= 20161214 (not installed)

u0_a185@localhost ~/luatest> lua test_requests.lua
lua: error loading module 'cjson.safe' from file '/data/data/com.termux/files/usr/lib/lua/5.3/cjson.so':
        dlopen failed: cannot locate symbol "floor" referenced by "/data/data/com.termux/files/usr/lib/lua/5.3/cjson.so"...
stack traceback:
        [C]: in ?
        [C]: in function 'require'
        /data/data/com.termux/files/usr/share/lua/5.3/requests.lua:7: in main chunk
        [C]: in function 'require'
        test_requests.lua:5: in main chunk
        [C]: in ?