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

Won't built against Lua >= 5.2 #36

Closed
LiamFry opened this issue Jan 11, 2018 · 8 comments · May be fixed by #84
Closed

Won't built against Lua >= 5.2 #36

LiamFry opened this issue Jan 11, 2018 · 8 comments · May be fixed by #84

Comments

@LiamFry
Copy link

LiamFry commented Jan 11, 2018

Will not build in Lua version >= 5.2 because lua_objlen() is used which is 5.1 only. It was renamed to lua_rawlen() starting in 5.2 I can find no statement(s) within the Cjson documentation noting this nor providing/suggesting a workaround.

Build ...

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.

Test ...
$ lua -e "require 'cjson'"

Results

/usr/local/bin/lua: error loading module 'cjson' from file '/usr/local/lib/lua/5.2/cjson.so':
	dlopen(/usr/local/lib/lua/5.2/cjson.so, 6): Symbol not found: _lua_objlen
  Referenced from: /usr/local/lib/lua/5.2/cjson.so
  Expected in: flat namespace
 in /usr/local/lib/lua/5.2/cjson.so
stack traceback:
	[C]: in ?
	[C]: in function 'require'
	(command line):1: in main chunk
	[C]: in ?
@agentzh
Copy link
Member

agentzh commented Jan 11, 2018

@LiamFry Lua 5.2 and etc are new languages and thus have new incompatible ABIs. They definitely need special treatment and support.

@peter-evans
Copy link

I've experienced this, too. The latest release seems to break support for Lua 5.3. Specifying version 2.1.0 is a workaround for now.
luarocks install lua-cjson 2.1.0

@peter-evans
Copy link

Just to clarify, even specifying version 2.1.0 still requires you to set the compatibility flag for Lua 5.1 (DLUA_COMPAT_5_1) when you build Lua 5.3. This is normal behavior. What is not normal is that even with the flag set version 2.1.0.6 of lua-cjson does not seem to respect the flag and fails to compile properly.

@Alloyed
Copy link

Alloyed commented Oct 17, 2020

Hi, this still seems to be the case even with #49: the last version uploaded to luarocks.org is 2.1.0.6-1, which will run in lua 5.1 but not 5.2/5.3, and downgrading to 2.1.0-1 will cause luajit-based builds to fail (see mpx#51).

Is there an expected cadence for when #49 will be included in a new release and will that new release be uploaded to luarocks?

@agentzh
Copy link
Member

agentzh commented Oct 17, 2020

@Alloyed Thanks for the report. We'll look into this with the help of @leafo.

@blueowl04
Copy link

Hello, I am a bit confused about the releases and the building/running issues on Lua > 5.1

First, it seems that Lua > 5.1 support was merged in #49. Also there is 2.1.0.8 release available.
However, there are still issues, because 2.1.0.8 doesn't seem to contain @leafo fixes. So please consider making 2.1.0.9 release ASAP.

It would be also very helpful if you could add lua-cjson-2.1.0.9-1.rockspec and also new lua-cjson.rockspec (for master branch).
And they should be uploaded to LuaRocks, because it still contains the old 2.1.0.6 version that is broken.

@blueowl04
Copy link

Oh, BTW the release 2.1.0.8 still contains
#define CJSON_VERSION "2.1.0.6"
in lua_cjson.c

@leafo
Copy link

leafo commented Oct 17, 2022

Closing this issue as we've had support for building in Lua 5.2+ in the master branch for over a year now. (Those versions are also now available on luarocks.org)

Note: there is still no support for Lua 5.3 integers at the time of this comment.

@leafo leafo closed this as completed Oct 17, 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

Successfully merging a pull request may close this issue.

6 participants