Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm not very good at manual installation. I want to use lcurses, a binding of curses for Lua in a program, with require('curses'). When I run make in the lcurses directory, there is an error complaining about the path LUA, defined in the Makefile, not existing.

I think I need to figure out where the correct Lua directory is, but I don't know where it might be. I've searched with Nautilus and its searching thingy, but I couldn't find a directory named "Lua" that had include, lib, and bin subdirectories, all of which seem to be wanted in the Makefile.

I'm not sure that the directory is the only issue, though. How do I set it up? I'm on Ubuntu 11.10, if that helps, and I've never managed to get a Lua require thingy to work.

And this is what the beginning of the Makefile looks like:

# makefile for lcurses library for Lua

# dist location
DISTDIR=$(HOME)/dist
TMP=/tmp

# change these to reflect your Lua installation
LUA=/usr/bin/lua
LUAINC= $(LUA)/include
LUALIB= $(LUA)/lib
LUABIN= $(LUA)/bin
share|improve this question

2 Answers 2

Most distributions install Lua next to all other programs in /usr, not to a directory of its own; LUA = /usr seems to be the correct path here, at least on Arch.

If it is not, search for files include/lua.h or lib/liblua.a, after installing the proper -dev packages if necessary.

find / -name lua.h
share|improve this answer
    
Using "find / -name lua.h" brought up a directory of "/usr/include/lua5.1/lua.h". LUA = /usr did not work, I got a "No such file or directory" error, again. –  Uronym Feb 13 '12 at 0:24
    
@Uronym: From that result, it seems that you have to redefine the variables directly: LUA = /usr, LUAINC = /usr/include/lua5.1. For LUALIB, use the same command to find liblua.a, I am guessing LUALIB = /usr/lib/lua5.1 though. –  grawity Feb 13 '12 at 0:26
    
LUA=/usr LUAINC= /usr/include/5.1 LUALIB= /usr/lib/lua5.1 LUABIN= /usr/bin/lua5.1 did not work, same error. Is that what you meant? –  Uronym Feb 13 '12 at 18:32
    
@Uronym: No; LUA=/usr LUAINC=/usr/include/lua5.1 LUALIB=/usr/lib/lua5.1 LUABIN=/usr/bin. –  grawity Feb 15 '12 at 11:29

If you install the Lua .deb package, you should have no problem. The following script should tell you where Lua is looking for modules of both the Lua and compiled C varieties:

strPaths = package.path .. "\r?\n"
strPaths = strPaths .. package.cpath 
strPaths = string.gsub(strPaths, ";", "\r?\n")
print strPaths

You can also set a custom path using an environmental variable. See the Lua Reference manual documentation for package.path and package.cpath.

Finally, a script can set its own path to a module. See http://lua.2524044.n2.nabble.com/Setting-LUA-PATH-from-lua-script-tc7649425.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.