Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To explain the problem (try two):

I can't install the lua compiler (lua dot org) with the newest version of Ubuntu, quote out of the manual to install lua:

Installing Lua

Lua is distributed in source form. You need to build it before using it. Building Lua should be straightforward because Lua is implemented in pure ANSI C and compiles unmodified in all known platforms that have an ANSI C compiler. [Right this Ubuntu does not have, as it seems... ] Lua also compiles unmodified as C++. [As it seem nope, the error msg is further below...] The instructions given below for building Lua are for Unix-like platforms. See also instructions for other systems and customization options.

If you don't have the time or the inclination to compile Lua yourself, get a binary from LuaBinaries. Try also Lua for Windows, an easy-to-use distribution of Lua that includes many useful libraries.

Building Lua

In most Unix-like platforms, simply do "make" with a suitable target. Here are the details.

Open a terminal window and move to the top-level directory, which is named lua-5.2.3. The Makefile there controls both the build process and the installation process.

Do "make" and see if your platform is listed. The platforms currently supported are:

aix ansi bsd freebsd generic linux macosx mingw posix solaris

If your platform is listed, just do "make xxx", where xxx is your platform name. [The make command does not have an ansi c option.] If your platform is not listed, try the closest one or posix, generic, ansi, in this order.

The compilation takes only a few moments and produces three files in the src directory: lua (the interpreter), luac (the compiler), and liblua.a (the library).

To check that Lua has been built correctly, do "make test" after building Lua. This will run the interpreter and print its version string.

If you're running Linux and get compilation errors, make sure you have installed the readline development package. If you get link errors after that, then try "make linux MYLIBS=-ltermcap".

Installing Lua

Once you have built Lua, you may want to install it in an official place in your system. In this case, do "make install". The official place and the way to install files are defined in the Makefile. You'll probably need the right permissions to install files.

To build and install Lua in one step, do "make xxx install", where xxx is your platform name.

To install Lua locally, do "make local". This will create a directory install with subdirectories bin, include, lib, man, and install Lua as listed below. To install Lua locally, but in some other directory, do "make install INSTALL_TOP=xxx", where xxx is your chosen directory.

    lua luac 
    lua.h luaconf.h lualib.h lauxlib.h lua.hpp 
    lua.1 luac.1 

These are the only directories you need for development. If you only want to run Lua programs, you only need the files in bin and man. The files in include and lib are needed for embedding Lua in C or C++ programs."

The Error Msg, quote:

awytok@awytok-Athlon-II:~/Desktop/lua-5.2.3$ make linux
cd src && make linux
make[1]: Entering directory `/home/awytok/Desktop/lua-5.2.3/src'
make all SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline"
make[2]: Entering directory `/home/awytok/Desktop/lua-5.2.3/src'
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lapi.o lapi.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lcode.o lcode.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lctype.o lctype.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldebug.o ldebug.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldo.o ldo.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldump.o ldump.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lfunc.o lfunc.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lgc.o lgc.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o llex.o llex.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lmem.o lmem.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lobject.o lobject.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lopcodes.o lopcodes.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lparser.o lparser.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lstate.o lstate.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lstring.o lstring.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ltable.o ltable.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ltm.o ltm.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lundump.o lundump.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lvm.o lvm.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lzio.o lzio.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lauxlib.o lauxlib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lbaselib.o lbaselib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lbitlib.o lbitlib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lcorolib.o lcorolib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ldblib.o ldblib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o liolib.o liolib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lmathlib.o lmathlib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o loslib.o loslib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lstrlib.o lstrlib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o ltablib.o ltablib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o loadlib.o loadlib.c
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o linit.o linit.c
ar rcu liblua.a lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o lundump.o lvm.o lzio.o lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o lmathlib.o loslib.o lstrlib.o ltablib.o loadlib.o linit.o 
ranlib liblua.a
gcc -O2 -Wall -DLUA_COMPAT_ALL -DLUA_USE_LINUX    -c -o lua.o lua.c
lua.c:67:31: fatal error: readline/readline.h: No such file or directory
 #include <readline/readline.h>
compilation terminated.
make[2]: *** [lua.o] Error 1
make[2]: Leaving directory `/home/awytok/Desktop/lua-5.2.3/src'
make[1]: *** [linux] Error 2
make[1]: Leaving directory `/home/awytok/Desktop/lua-5.2.3/src'
make: *** [linux] Error 2

I don't want to, can not, and will not modify the file behind the make linux command with to extend it with parameters for -ansi -pedantic...

So I have two theories, it's something wrong with the file behind make linux of lua, or with the additionally installed compiler gcc, hm! I send a copy of this question also to the lua team!

share|improve this question
Both lua5.2 and lua5.1 should be available in the latest (14.04) Ubuntu. BTW your build error appears to be due to a missing readline development library dependency - nothing to do with ANSI C compilers. – steeldriver Jun 21 '14 at 8:04

And the Lua mailing lists' answer:

About the comment above of steeldriver: Yes, arr, something similar got mentioned by Mr. Vaughan through the Lua mailing list, but, how life does play, I can not install this package with the file readline.h (alternatives?), quote:

"Quoting "Gary V. Vaughan" :

On Jun 21, 2014, at 8:33 AM, wrote:

I can't install the lua compiler (lua do org) with the newest version of Ubuntu [[snip]] lua.c:67:31: fatal error: readline/readline.h: No such file or directory

include < readline/readline.h >

As you can see from the error message your system is missing the readline.h header file.

Close to the top of the list of results when googling "ubuntu readline.h" is the solution:

Hope that helps, --Gary V. Vaughan (gary AT vaughan DOT pe) Recent comment:

Thanks for this comment, this I didn't knew, couldn't elicite...

But I can't install the package libreadline6-dev in Ubuntu cause of a dependency error which means (honestly, yes, that it shows); It's depending on libreadline6-dev...

And better news; After regoogling I found this:

These made the readline.h part running. And I retry to install lua...

regards, and thanks Mr. M. Bärlocher"

share|improve this answer

Your Answer


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.