Skip navigation.
KDE Developer's Journals

Why we should not rely on pkg-config...

alexander neundorf's picture

I'm just trying to compile Battle of Wesnoth (yes, for me gaming means compiling games... Eye-wink ).
I just built it with CMake, which first complained that it didn't find Lua 5.1. I checked, it really wasn't there. So I downloaded the sources for lua, make, make install, and now lua is in /usr/local/.
Then I run cmake again on Wesnoth and it happily finds Lua, so CMake now succeeds and I can build Wesnoth.

To have more fun, I'm trying right now the autotools build for Wesnoth:

checking for LUA... checking for LUA... configure: error: Package requirements (lua5.1 >= 5.1) were not met:

No package 'lua5.1' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix.

So it uses pkg-config to find Lua, and fails with that. Why ? Because Lua doesn't install a pkg-config file:

lua-5.1.4$ sudo make install
cd src && mkdir -p /usr/local/bin /usr/local/include /usr/local/lib /usr/local/man/man1 /usr/local/share/lua/5.1 /usr/local/lib/lua/5.1
cd src && install -p -m 0755 lua luac /usr/local/bin
cd src && install -p -m 0644 lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp /usr/local/include
cd src && install -p -m 0644 liblua.a /usr/local/lib
cd doc && install -p -m 0644 lua.1 luac.1 /usr/local/man/man1
hammer:~/src/packages/lua-5.1.4$     

So, now I'm sitting here fiddling around with this stuff, even although Lua is in the number 2 location where you would expect it (i.e. /usr/local, not /usr)...

So, let's just not rely on an optional additional tool for our builds.

Alex

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kevinkofler's picture

Bug in Lua

Sorry, but I blame Lua's make install there, for not installing the .pc file as it's supposed to.

As much as I hate the autotools, this one is not really their fault (and you'd get the same if you used CMake's pkg-config macros).

ausmusj's picture

Just as a note - the lua.pc

Just as a note - the lua.pc file is contained under the "etc" directory where you unpacked the source tarball. It's just not automatically installed via make install...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.