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

The problem is very simple.

The generated .c file has #include <lua.h>;

valac -C --pkg lua luatest.vala

which should be #include <lua52/lua.h>;

I have found all lua headers in /usr/include/lua52,

but pkg-config for vala(c) cannot find them.

the error is
/home/aleksandar/Programing/ewns-viewer/ewns-viewer.vala.c:8:17: fatal error: lua.h: No such file or directory

Please help.

share|improve this question
/home/aleksandar/Programing/ewns-viewer/ewns-viewer.vala.c:8:17: fatal error: lua.h: No such file or directory – Aleksandar Jun 1 '12 at 13:54
@jackweirdy This is not true. For that to work, then -I/usr/include/lua52 would need to be in the CFLAGS. – dobey Jun 1 '12 at 16:36
@dobey didn't know that, I removed my comment to avoid future confusion :) – jackweirdy Jun 2 '12 at 10:47

How did you install liblua? If I install the liblua50-dev package, then pkg-config --cflags lua50 prints the correct include path. Does running pkg-config --cflags lua52 print the correct include path for you? I think you need to add the CFLAGS manually, as the lua.vapi in vala doesn't seem to know about what package to use for lua with pkg-config here.

I don't know what you're using for a build system exactly, but you can do this manually by running valac like so:

valac -X "-I/usr/include/lua52" -C --pkg lua luatest.vala
share|improve this answer
Unknown option -Xcc=-I/usr/include/lua52. I am using valac 0.14.I installed lua52-dev from synaptic. – Aleksandar Jun 1 '12 at 17:22
valac --pkg lua luatest.vala -X -I/usr/include/lua52 /home/aleksandar/Desktop/luatest.vala.c:7:17: fatal error: lua.h: No such file or directory compilation terminated. error: cc exited with status 256 Compilation failed: 1 error(s), 0 warning(s) – Aleksandar Jun 1 '12 at 17:24
Installed it from where? There is no lua52-dev in Ubuntu precise, or even on quantal. There is only liblua50-dev. If lua.h is actually in /usr/include/lua52 as you stated, the command I listed should work. – dobey Jun 1 '12 at 18:11
There is luadev52,newest version is 5.2.0-2. Ok.I tried your command for the second time and it works.Now I do not know how to link this to glib and vala :D – Aleksandar Jun 1 '12 at 18:24
There is no such lua package in the Ubuntu archives, or in Debian. You must be installing it from a PPA. Vala uses glib by default, but you will need to list the additional packages you use, using --pkg as with lua. I don't know what you're using for a build system, but Vala has excellent integration with autotools (automake and autoconf). If my answer works for you, please click "Accept" for it. Thanks. – dobey Jun 1 '12 at 19:29

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.