Page 1 of 1

Add library to lua : raspberry

Posted: Monday 13 March 2017 15:43
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.

Re: Add library to lua : raspberry

Posted: Monday 13 March 2017 17:01
by joebar
Maybe with..
(In your lua script)

package.path = '/home/username/folder/?.lua'
require('luars232')

Re: Add library to lua : raspberry

Posted: Monday 13 March 2017 17:29
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.

Re: Add library to lua : raspberry

Posted: Monday 13 March 2017 18:07
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

Re: Add library to lua : raspberry

Posted: Monday 13 March 2017 18:47
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.