Skip to content

launchdarkly-server-sdk.c won't compile with LuaJIT #14

@LeshnaShamloll

Description

@LeshnaShamloll

When using luarocks provided by LuaJIT (version 2.1) to make the launchdarkly-server-sdk-1.0-0.rockspec file, the launchdarkly-server-sdk.c file (from release version 1.0.0) fails to compile, with an error saying:

launchdarkly-server-sdk.c:1179:13: error: static declaration of 'luaL_setfuncs' follows non-static declaration
 1179 | static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
      |             ^~~~~~~~~~~~~
In file included from launchdarkly-server-sdk.c:7:
/usr/local/openresty/luajit/include/luajit-2.1/lauxlib.h:88:18: note: previous declaration of 'luaL_setfuncs' was here
   88 | LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
      |                  ^~~~~~~~~~~~~

Error: Build error: Failed compiling object launchdarkly-server-sdk.o
launchdarkly-server-sdk 1.0-0 depends on lua >= 5.1, <= 5.4 (5.1-1 provided by VM)
gcc -O2 -fPIC -I/usr/local/openresty/luajit/include/luajit-2.1 -c launchdarkly-server-sdk.c -o launchdarkly-server-sdk.o -I/usr/local/include

This is probably because the preprocessor directive at line 1175
#if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501
adds a luaL_setfuncs function since Lua5.1 doesn't seem to have it, but this method is already present in LuaJIT, resulting in a conflict.

Since the Readme mentions support for LuaJIT, we assume that this is an issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions