How compile/get Luasocket to work on FreeBSD with Domoticz

On various Hardware and OS systems: pi / windows / routers / nas, etc
Post Reply
Whiskey
Posts: 6
Joined: Monday 07 May 2018 20:35
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

How compile/get Luasocket to work on FreeBSD with Domoticz

Post by Whiskey » 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

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"
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:
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.
So I tried adding that to lua/src/CMakeLists.txt:

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")
And for compiling luasocket I only changed the option in src/makefile that specifies where the Lua headers are kept:

Code: Select all

LUAINC_freebsd?=/home/domoticz/domoticz/lua/src/
But no luck :cry:

I've been stuck for days trying to get this to work, so any pointers are much appreciated.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest