lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 2014-08-20 7:05 AM, "Robert Brown" <rebrown@exemail.com.au> wrote:
>
> Hi
> I wish to run a couple of lua scripts written by a competent person (as opposed to noob me) on a raspberry pi (kernel 3.10.25+) using a usb connection from an Arduino shield. The scripts were originally written to read data from the Arduino uart port and I want to read from the usb port instead so I will need to do some hacking.
>
> First step after installing lua was to get libusb installed.
> I chose to use libusb-1.0.19 from http://sourceforge.net/projects/libusb/files/latest/ which compiled ok from a tar.gz file.
>
> Then I did
> cp /home/pi/libusb-1.0.19/libusb/.libs/libusb-1.0.so libusb.so
>
> and then
> sudo cp /home/pi/libusb-1.0.19/libusb.so /usr/local/lib/lua/5.1/
>
> At this point I get an error when I run
> lua
> Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> > require('libusb')
> error loading module 'libusb' from file './libusb.so':
>     ./libusb.so: undefined symbol: luaopen_libusb
> stack traceback:
>     [C]: ?
>     [C]: in function 'require'
>     stdin:1: in main chunk
>     [C]: ?
>
> Can anyone offer some advice on where I go from here?
>
> Thanks
>

The problem is Lua can't load libusb.so directly. Like the message says, it can't find the luaopen_libusb function in that module. You need a library which binds libusb to Lua.