So I've cloned the LuaSocket repository and managed to get it to compile against Lua in domoticz, but it fails to load the module with
Code: Select all
Error: EventSystem: in /usr/home/domoticz/domoticz/scripts/lua/script_time_checkLights.lua: error loading module 'socket.core' from file '/usr/local/lib/lua/5.2/socket/core.so':
2018-06-10 14:05:00.013 /usr/local/lib/lua/5.2/socket/core.so: Undefined symbol "lua_gettop"
So I tried adding that to lua/src/CMakeLists.txt:In UNIX, you can use the dynamic or the static libraries. But when using the static libraries remember to include the parameter "-Wl,-E" in Linux to make the application exports the Lua functions, so the loaded modules are not dependent on the LuaBinaries dynamic libraries.
Code: Select all
IF(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
SET(OperatingSystem "Linux")
SET(COMMON_LDFLAGS "${COMMON_LDFLAGS} -Wl,-E")
add_definitions(-DLUA_USE_LINUX)
ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Linux|FreeBSD")
Code: Select all
LUAINC_freebsd?=/home/domoticz/domoticz/lua/src/
I've been stuck for days trying to get this to work, so any pointers are much appreciated.