How compile/get Luasocket to work on FreeBSD with Domoticz
Posted: Tuesday 12 June 2018 0:44
I am trying to get the Hue status check script to work on FreeBSD for which I need LuaSocket. The Philips Hue wiki page refers to another wiki page that details how to install luasocket library files that have been precompiled for the Pi. Those don't work on FreeBSD And neither does the FreeBSD package of LuaSocket.
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
I've been searching for a while and have not found a way to fix this. I did find this issue and this page that both say to use "-Wl,-E" parameters when building lua:
And for compiling luasocket I only changed the option in src/makefile that specifies where the Lua headers are kept:
But no luck
I've been stuck for days trying to get this to work, so any pointers are much appreciated.
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.