Add library to lua : raspberry

Moderator: leecollings

Post Reply
St7ven
Posts: 22
Joined: Friday 10 March 2017 9:27
Target OS: Windows
Domoticz version:
Contact:

Add library to lua : raspberry

Post by St7ven »

Hello,

I instaled the librs232 library in the raspberry along domoticz. (home/username/ folder). When I call

Code: Select all

require("luars232")
I get

Code: Select all

no field package.preload['luars232']
no file '/usr/local/share/lua/5.2/luars232.lua'
no file '/usr/local/share/lua/5.2/luars232/init.lua'
no file '/usr/local/lib/lua/5.2/luars232.lua'
no file '/usr/local/lib/lua/5.2/luars232/init.lua'
no file './luars232.lua'
no file '/usr/local/lib/lua/5.2/luars232.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './luars232.so'
How can I include the "home/username/librs232/dist/lib" to the domoticz path variable ?

I set the $PATH environoment variable on rasberry debian jessie. But the error is still prompted in the domoticz log.
joebar
Posts: 35
Joined: Tuesday 24 January 2017 12:19
Target OS: -
Domoticz version:
Contact:

Re: Add library to lua : raspberry

Post by joebar »

Maybe with..
(In your lua script)

package.path = '/home/username/folder/?.lua'
require('luars232')
St7ven
Posts: 22
Joined: Friday 10 March 2017 9:27
Target OS: Windows
Domoticz version:
Contact:

Re: Add library to lua : raspberry

Post by St7ven »

Its work well to link to the lib folder. Thank you.

Unfortunatly, I get the following error

Code: Select all

/home/pi/librs232/dist/lib/luars232.so:1: unexpected symbol near char(127)
The luars232.so is known to work and it has been confirmed with a lua (commande line) windows (available when I installed the lua library in windows.
User avatar
jvdz
Posts: 2269
Joined: Tuesday 30 December 2014 19:25
Target OS: Raspberry Pi / ODroid
Domoticz version: 4.107
Location: Netherlands
Contact:

Re: Add library to lua : raspberry

Post by jvdz »

Just add the library to \usr\local\lib\lua\5.2 which is the standard place for this.
Another option is you specify the fully qualified name in the require statement:
require("/home/username/..../luars232") Replace the .... with the exact directory.

Jos
New Garbage collection scripts: https://github.com/jvanderzande/GarbageCalendar
simonrg
Posts: 329
Joined: Tuesday 16 July 2013 22:54
Target OS: Raspberry Pi / ODroid
Domoticz version: 3.8807
Location: North East England
Contact:

Re: Add library to lua : raspberry

Post by simonrg »

St7ven wrote:Its work well to link to the lib folder. Thank you.
Unfortunatly, I get the following error

Code: Select all

/home/pi/librs232/dist/lib/luars232.so:1: unexpected symbol near char(127)
The luars232.so is known to work and it has been confirmed with a lua (commande line) windows (available when I installed the lua library in windows.
Are you sure you have the Lua 5.2 version of the library for Raspian (Debian) on a Raspberry Pi (Arm)?
The error would be consistent with the wrong binary in the .so file.
Possibly stating the obvious the Windows version working doesn't really help as you will need a different version compiled for Raspberry Pi.
Raspberry Pi 2 B - 2A@5V PSU - Raspbian + Domoticz + RFXtrx(89), LightwaveRF House(dimmers, sockets, wireless/mood switches), Owl CM113, 4 LaCross Temp / Humidity Sensors, 4 Siemens PIR, Smappee, Solaredge, ESP8266
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest