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

lua_objlen with Lua 5.3 using -DLUA_COMPAT_5_1 #40

Closed
peter-evans opened this issue Jun 27, 2018 · 1 comment
Closed

lua_objlen with Lua 5.3 using -DLUA_COMPAT_5_1 #40

peter-evans opened this issue Jun 27, 2018 · 1 comment

Comments

@peter-evans
Copy link

I'm trying to install lua-cjson in a Lua 5.3 environment with hererocks. While installing lua-cjson it failed with "warning: implicit declaration of function 'lua_objlen'." I found this issue suggesting it could be resolved by compiling Lua with the compatibility flag for 5.1, however, it doesn't seem to work. If someone could point me in the right direction to resolve this I would be grateful.

This is the Dockerfile that I'm building:

FROM python:3.6.5

ENV LUA_VERSION 5.3
ENV LUA_DIR “/lua_install”
ENV PATH “$PATH:$LUA_DIR/bin”

RUN apt-get -y update \
 && apt-get install -y -qq --no-install-recommends unzip \
 && pip install hererocks \
 && hererocks $LUA_DIR -r^ --lua=$LUA_VERSION --compat=all --verbose \
 && luarocks install lua-cjson

Hererocks seems to compile Lua with the -DLUA_COMPAT_5_1 flag:

Building Lua 5.3.4 (compat: all)
Skipping 4 patches, use --patch to apply them
Running gcc -std=gnu99 -O2 -Wall -Wextra -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_USE_READLINE -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -c -o lapi.o lapi.c
...

However, the installation of lua-cjson still throws this warning and is unusable:

Installing https://luarocks.org/lua-cjson-2.1.0.6-1.src.rock
lua_cjson.c: In function ‘json_append_data’:
lua_cjson.c:743:19: warning: implicit declaration of function ‘lua_objlen’ [-Wimplicit-function-declaration]
             len = lua_objlen(l, -1);
                   ^~~~~~~~~~
gcc -O2 -fPIC -I/lua_install/include -c lua_cjson.c -o lua_cjson.o

The full Docker build log: docker-build-log.txt

@peter-evans
Copy link
Author

Looks like this is an issue with the latest release of lua-cjson. See this issue: mpx/lua-cjson#56

Specifying the previous release fixes the problem:

luarocks install lua-cjson 2.1.0

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

1 participant