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

I've installed all lua5.1 development packages from Synaptic and the g++ linker can not find -llua. I've read on some other question that it is possible that -llua has some other name and that I should fix it. But the problem is that I can't seem to find the lua.o or whatever it is called.

share|improve this question
up vote 5 down vote accepted

gcc … -llua looks for a file called if you're linking dynamically (the default) or liblua.a if you're linking statically.

You can look for the package(s) containing a file by a certain name with apt-file Install apt-file. You can also make this search online on (“Search the contents of package”, be sure to select your distribution and architecture). But…

$ apt-file search

What's going on is that Ubuntu ships multiple versions of the Lua libraries, and they aren't binary compatible, i.e. you need to select the one you want at build time.

$ apt-file --regexp search '/liblua.*\.so$'
<lots of hits>

As of natty, the preferred version of Lua is 5.1, with 5.0 and 4.0 also available. The corresponding lua libraries for linking are, and (you can list the files in a package with dpkg -L liblua5.1-0-dev or apt-file list liblua5.1-0-dev). So you need to change your linking command to -llua5.1 (or -llua50 or -llua40 if you need a binary that's compatible with older systems).

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.