Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems with cjson.so: undefined symbol: lua_objlen #739

Closed
rafauke opened this issue May 2, 2021 · 2 comments
Closed

Problems with cjson.so: undefined symbol: lua_objlen #739

rafauke opened this issue May 2, 2021 · 2 comments

Comments

@rafauke
Copy link

rafauke commented May 2, 2021

Hello,

I am following the tutorial and I have installed lapis with luarocks, but it looks like cjson is not working correctly. It shows warnings during lapis installation and then throws when trying to use lapis command.

Installation:

lua-cjson 2.1.0.6-1 depends on lua >= 5.1 (5.4-1 provided by VM)
gcc -O2 -fPIC -I/usr/include -c lua_cjson.c -o lua_cjson.o
lua_cjson.c: In function ‘json_append_data’:
lua_cjson.c:743:19: warning: implicit declaration of function ‘lua_objlen’; did you mean ‘lua_len’? [-Wimplicit-function-declaration]
  743 |             len = lua_objlen(l, -1);
      |                   ^~~~~~~~~~
      |                   lua_len

and when running lapis:

/usr/bin/lua5.4: /usr/share/lua/5.4/luarocks/loader.lua:104: error loading module 'cjson' from file '/home/user/.luarocks/lib/lua/5.4/cjson.so':
        /home/user/.luarocks/lib/lua/5.4/cjson.so: undefined symbol: lua_objlen
stack traceback:
        [C]: in local 'a_loader'
        /usr/share/lua/5.4/luarocks/loader.lua:104: in function </usr/share/lua/5.4/luarocks/loader.lua:101>
        (...tail calls...)
        [C]: in function 'require'
        /home/user/.luarocks/share/lua/5.4/lapis/util.lua:2: in main chunk
        [C]: in function 'require'
        .../user/.luarocks/share/lua/5.4/lapis/cmd/util.lua:7: in main chunk
        [C]: in function 'require'
        ...user/.luarocks/share/lua/5.4/lapis/cmd/actions.lua:3: in main chunk
        [C]: in function 'require'
        ....luarocks/lib/luarocks/rocks-5.4/lapis/1.9.0-1/bin/lapis:3: in main chunk
        [C]: in ?

It looks like this workaround fixes the problem: mpx/lua-cjson#56 (comment)

$ luarocks remove lua-cjson
$ luarocks install lua-cjson 2.1.0-1

I'm just leaving it here, because maybe someone else will have the same similar issue. Cheers :)

@filu34
Copy link

filu34 commented May 20, 2022

Didn't work for me.

EDIT:

Actually this one worked out.

$ luarocks remove lua-cjson
$ luarocks install lua-cjson 2.1.0-1

But it's old package. So issue is still there if updated.

@leafo
Copy link
Owner

leafo commented Nov 7, 2022

Closing this as the version of cjson in LuaRocks will work with all versions of Lua

@leafo leafo closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants