using LUAROCKS in FusionPBX box

Status
Not open for further replies.

ewdpb

Member
Oct 3, 2019
151
19
18
Hi all,

I am trying to install LUA packet through luarocks but it complains about not finding lua.h:

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
myself@myhost:~# sudo luarocks install http
Installing https://luarocks.org/http-0.3-0.src.rock
Missing dependencies for http 0.3-0:
compat53 >= 0.3 (not installed)
cqueues >= 20161214 (not installed)
luaossl >= 20161208 (not installed)
basexx >= 0.2.0 (not installed)
lpeg (not installed)
lpeg_patterns >= 0.5 (not installed)
binaryheap >= 0.3 (not installed)
fifo (not installed)

http 0.3-0 depends on compat53 >= 0.3 (not installed)
Installing https://luarocks.org/compat53-0.7-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.3 -c lutf8lib.c -o lutf8lib.o
In file included from lprefix.h:46,
from lutf8lib.c:10:
c-api/compat-5.3.h:10:10: fatal error: lua.h: No such file or directory
#include <lua.h>
^~~~~~~
compilation terminated.

Error: Failed installing dependency: https://luarocks.org/compat53-0.7-1.src.rock - Build error: Failed compiling object lutf8lib.o


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

lua.h is actually there:

myself@myhost::~# sudo find / -name lua.h
/usr/include/lua5.1/lua.h

But I guess it is not in the expected location. Anyone has any idea where I should look next?

Thanks!
 

JamesBorne

Active Member
Jan 24, 2019
294
57
28
Australia
You did a pretty poor job of installing luarocks.
I've never heard of it, but simply going to their build instructions reveals:
Code:
Run ./configure. (This will attempt to detect your installation of Lua.
If you get any error messages, see the section "Customizing your settings", below.)

And natuarally, I got this error:
Code:
root@host:/dirs/luarocks-3.2.1# ./configure

Configuring LuaRocks version 3.2.1...

Lua interpreter not found in $PATH
You may want to use the flags --with-lua, --with-lua-bin and/or --lua-version
Run ./configure --help for details.

configure failed.

This would explain why your install of http throws a lua.h critical error.

Following the build instructions leads you to a series of flags you can use to specify Lua version, include directories, etc.

According to these outdated Freeswitch instructions for luarocks, it is suggested to install a Lua binary through the package manager.
I decided on apt install lua5.1, as you rightly demonstrated, the lua.h is inside a lua5.1 directory (probably what version freeswitch-mod-lua is at)

Finally, with Lua installed and an include path passed (again, as you pointed out), I ran and got:
Code:
root@host:/dirs/luarocks-3.2.1# ./configure --with-lua-include="/usr/include/lua5.1/"

Configuring LuaRocks version 3.2.1...

Lua version detected: 5.1
Lua interpreter found: /usr/bin/lua5.1
lua.h found: /usr/include/lua5.1/lua.h
unzip found in PATH: /usr/bin

Done configuring.

LuaRocks will be installed at......: /usr/local
LuaRocks will install rocks at.....: /usr/local
LuaRocks configuration directory...: /usr/local/etc/luarocks
Using Lua from.....................: /usr

* Type make and make install:
  to install to /usr/local as usual.
* Type make bootstrap:
  to install LuaRocks into /usr/local as a rock.

Allowing me to run make build and make install

* NOTE 1 - I had to do apt install libssl-dev to get luarocks to install http
* NOTE 2- I have never used luarocks or any lua package, so I can't help onwards - at least lua rocks is installed
* NOTE 3 - you could likely skip most of the manual install and use the upstream repo build of luarocks if you work out how to include "/usr/include/lua5.1/" in the config file /etc/luarocks/config.lua
 
Last edited:

ewdpb

Member
Oct 3, 2019
151
19
18
Thanks very much @JamesBorne for taking the time. To be honest I did not want to mess around too much with different packages for I have found that fusionpbx is quite moody. I did not want to break anything. I am about to test on a clean box, It should all go well. Thanks again!
 
  • Like
Reactions: JamesBorne
Status
Not open for further replies.