How compile/get Luasocket to work on FreeBSD with Domoticz

On various Hardware and OS systems: pi / windows / routers / nas, etc

Moderator: leecollings

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 »

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.
Derik
Posts: 1601
Joined: Friday 18 October 2013 23:33
Target OS: Raspberry Pi / ODroid
Domoticz version: BETA
Location: Arnhem/Nijmegen Nederland
Contact:

Re: How compile/get Luasocket to work on FreeBSD with Domoticz

Post by Derik »

He the same issue here, on ubuntu lts 18.04

Perhaps found a solution?
Xu4: Beta Extreme antenna RFXcomE,WU Fi Ping ip P1 Gen5 PVOutput Harmony HUE SolarmanPv OTG Winddelen Alive ESP Buienradar MySensors WOL Winddelen counting RPi: Beta SMAspot RFlinkTest Domoticz ...Different backups
pagocs
Posts: 5
Joined: Sunday 06 November 2016 17:53
Target OS: NAS (Synology & others)
Domoticz version:
Contact:

Re: How compile/get Luasocket to work on FreeBSD with Domoticz

Post by pagocs »

If you still have the issue check this discussion and the possible solution: https://github.com/domoticz/domoticz/issues/3216
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest