Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 4 down vote accepted

gcc … -llua looks for a file called liblua.so 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 packages.ubuntu.com (“Search the contents of package”, be sure to select your distribution and architecture). But…

$ apt-file search liblua.so
$

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 liblua5.1.so, liblua50.so and liblua40.so (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
add comment

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.