Lua 5.1.5 fails to load cjson or cjson.safe
4mig4 opened this issue · comments
Using Lua 5.1.5
On Rocky Linux 8.7
Linux uhn5klbjhmgmt-p.lab.rmn.local 4.18.0-425.10.1.el8_7.x86_64 #1 SMP Thu Jan 12 16:32:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
gcc (GCC) 8.5.0 20210514 (Red Hat 8.5.0-16)
Luarocks compiles and installs it with no problem :
$ luarocks install lua-cjson
Warning: falling back to wget - install luasec to get native HTTPS support
Installing https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock
lua-cjson 2.1.0.10-1 depends on lua >= 5.1 (5.1-1 provided by VM)
gcc -O2 -fPIC -I/home/user1/.luaver/lua/5.1.5/include -c lua_cjson.c -o lua_cjson.o
gcc -O2 -fPIC -I/home/user1/.luaver/lua/5.1.5/include -c strbuf.c -o strbuf.o
gcc -O2 -fPIC -I/home/user1/.luaver/lua/5.1.5/include -c fpconv.c -o fpconv.o
gcc -shared -o cjson.so lua_cjson.o strbuf.o fpconv.o
lua-cjson 2.1.0.10-1 is now installed in /home/user1/.luaver/luarocks/3.9.2_5.1 (license: MIT)
However when issuing a require
on it it fail:
/usr/bin/lua: error loading module 'cjson.safe' from file '/home/user1/lib/lua/5.1/cjson/safe.so':
/home/user1/lib/lua/5.1/cjson/safe.so: undefined symbol: lua_pcall
stack traceback:
[C]: in ?
[C]: in function 'require'
./sgce_check.lua:4: in main chunk
[C]: in ?
My bad . closing it was the fault of #!/usr/bin/lua
instead of #!/usr/bin/env lua
, thus not using my luaver env but the default system lua!