Page MenuHomePhabricator

Cannot build EFL with -Dlua-interpreter=lua
Closed, ResolvedPublic

Description

EFL from Git on FreeBSD 11.3
Lua 5.2

Build errors:

[2258/4613] Compiling C object 'src/lib/elua/f6de7ab@@elua@sha/cache.c.o'
FAILED: src/lib/elua/f6de7ab@@elua@sha/cache.c.o
cc -Isrc/lib/elua/f6de7ab@@elua@sha -Isrc/lib/elua -I../src/lib/elua -I. -I.. -Isrc -I../src -Isrc/lib/eina -I../src/lib/eina -Isrc/lib/eo -I../src/lib/eo -Isrc/lib/efl -I../src/lib/efl -Isrc/lib/ecore -I../src/lib/ecore -Isrc/lib/ecore_file -I../src/lib/ecore_file -Isrc/lib/efl/interfaces -I/usr/local/include/lua52 -I/usr/local/include -Xclang -fcolor-diagnostics -pipe -D_FILE_OFFSET_BITS=64 -fvisibility=hidden -Wall -Wpointer-arith -Wunused-parameter -Wsign-compare -Wno-missing-field-initializers -DHAVE_CONFIG_H=1 -D_GNU_SOURCE=1 -DEFL_BETA_API_SUPPORT=1 -DELM_INTERNAL_API_ARGESFSDFEFC=1 -O -march=native -g -fPIC -pthread '-DPACKAGE_DATA_DIR="/usr/local/share/elua"' -DNEED_RUN_IN_TREE=1 -DEFL_BUILD=1 -MD -MQ 'src/lib/elua/f6de7ab@@elua@sha/cache.c.o' -MF 'src/lib/elua/f6de7ab@@elua@sha/cache.c.o.d' -o 'src/lib/elua/f6de7ab@@elua@sha/cache.c.o' -c ../src/lib/elua/cache.c
../src/lib/elua/cache.c:111:50: error: too few arguments to function call, expected 5, have 4
   int status = lua_load(L, getf, &buff, "=stdin");
                ~~~~~~~~                         ^
/usr/local/include/lua52/lua.h:261:1: note: 'lua_load' declared here
LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
^
/usr/local/include/lua52/luaconf.h:153:18: note: expanded from macro 'LUA_API'
#define LUA_API         extern
                        ^
../src/lib/elua/cache.c:166:45: error: too few arguments to function call, expected 5, have 4
   status = lua_load(L, getf_map, &s, chname);
            ~~~~~~~~                        ^
/usr/local/include/lua52/lua.h:261:1: note: 'lua_load' declared here
LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
^
/usr/local/include/lua52/luaconf.h:153:18: note: expanded from macro 'LUA_API'
#define LUA_API         extern
                        ^
../src/lib/elua/cache.c:189:55: error: too few arguments to function call, expected 5, have 4
             status = lua_load(L, getf_map, &s, chname);
                      ~~~~~~~~                        ^
/usr/local/include/lua52/lua.h:261:1: note: 'lua_load' declared here
LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
^
/usr/local/include/lua52/luaconf.h:153:18: note: expanded from macro 'LUA_API'
#define LUA_API         extern
                        ^
../src/lib/elua/cache.c:218:14: warning: implicit declaration of function 'lua_setfenv' is invalid in C99 [-Wimplicit-function-declaration]
             lua_setfenv(L, -2);
             ^
1 warning and 3 errors generated.

It seems that it works correctly with Lua 5.1.
If is is broken 'by design' - it would be nice to check Lua version during meson configure state and stop building with unsupported version of Lua.

ProhtMeyhet triaged this task as High priority.

lua 5.2 is explicitly supported in efl. 5.1 and 5.2 are supported. .53 and newer are not and 5.0 and older are not. lua does regularly break api/abi - so we have to explicitly change code to adapt to new lua versions. you can see in meson.build in the top dir:

luaold_interpreters = [
  ['lua',     ['>=5.1.0', '<5.3.0']],
  ['lua51',   ['>=5.1.0', '<5.2.0']],
  ['lua-5.1', ['>=5.1.0', '<5.2.0']],
  ['lua5.1',  ['>=5.1.0', '<5.2.0']],
  ['lua52',   ['>=5.2.0', '<5.3.0']],
  ['lua-5.2', ['>=5.2.0', '<5.3.0']],
  ['lua5.2',  ['>=5.2.0', '<5.3.0']],
]

we explicitly check/look for 5.1 and 5.2. i actually build against lua 5.2 here and it works fine.

raster closed this task as Resolved.Nov 30 2020, 2:42 AM
raster claimed this task.

actually i think this is just old and already long fixed as we have a macro for this:

#if LUA_VERSION_NUM > 501
#  define elua_load(L, reader, data, chunkname) lua_load(L, reader, data, chunkname, NULL)
#else
#  define elua_load(L, reader, data, chunkname) lua_load(L, reader, data, chunkname)
#endif

and it's used on like 117:

int status = elua_load(L, getf, &buff, "=stdin");