lua-cjson icon indicating copy to clipboard operation
lua-cjson copied to clipboard

error loading module cjson.safe

Open rayenmessaoudi opened this issue 7 years ago • 2 comments

i m trying to import the requests library but i got this error

error loading module 'cjson.safe' from file '/usr/local/lib/lua/5.2/cjson.so': /usr/local/lib/lua/5.2/cjson.so: undefined symbol: lua_objlen

any help ?

rayenmessaoudi avatar Apr 30 '18 15:04 rayenmessaoudi

Check the answer here: https://github.com/mpx/lua-cjson/issues/54 I think it also applies to you.

ignacio avatar Apr 30 '18 15:04 ignacio

i m looking for the solution. this case is Arm7.Amazon FireHD 10 : Tremux

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 ?

dauuricus avatar Sep 05 '21 17:09 dauuricus