-----Original Message----- From: sr-dev-bounces@lists.sip-router.org [mailto:sr-dev-bounces@lists.sip-router.org] On Behalf Of Ovidiu Sas Sent: Monday, October 04, 2010 7:48 PM To: sr-dev Subject: [sr-dev] kamailio 3.1 app_lua - CentOS install issue
app_lua fails to install on CentOS due to the following error:
- make every-module group_include=klua
CC (gcc) [M app_lua.so] app_lua_api.o CC (gcc) [M app_lua.so] app_lua_exp.o CC (gcc) [M app_lua.so] app_lua_mod.o CC (gcc) [M app_lua.so] app_lua_sr.o make[2]: `libkcore.so.1.0' is up to date. LD (gcc) [M app_lua.so] app_lua.so /usr/bin/ld: cannot find -llua5.1 collect2: ld returned 1 exit status make[1]: *** [app_lua.so] Error 1 make: *** [modules] Error 1 error: Bad exit status from /var/tmp/rpm-tmp.57650 (%build)
With the attached patch, it installs ok: diff --git a/modules/app_lua/Makefile b/modules/app_lua/Makefile index a466ab9..f703ac7 100644 --- a/modules/app_lua/Makefile +++ b/modules/app_lua/Makefile @@ -8,7 +8,7 @@ include ../../Makefile.defs auto_gen= NAME=app_lua.so -LIBS= -llua5.1 +LIBS= -llua-5.1
DEFS+=-I/usr/include/lua5.1 DEFS+=-DOPENSER_MOD_INTERFACE
The library is lua-5.1: # rpm -q --list lua /usr/bin/lua /usr/bin/luac /usr/lib/liblua-5.1.so /usr/share/doc/lua-5.1.2 /usr/share/doc/lua-5.1.2/COPYRIGHT /usr/share/doc/lua-5.1.2/HISTORY /usr/share/doc/lua-5.1.2/README /usr/share/doc/lua-5.1.2/amazon.gif /usr/share/doc/lua-5.1.2/contents.html /usr/share/doc/lua-5.1.2/cover.png /usr/share/doc/lua-5.1.2/logo.gif /usr/share/doc/lua-5.1.2/lua.css /usr/share/doc/lua-5.1.2/lua.html /usr/share/doc/lua-5.1.2/luac.html /usr/share/doc/lua-5.1.2/manual.css /usr/share/doc/lua-5.1.2/manual.html /usr/share/doc/lua-5.1.2/readme.html /usr/share/man/man1/lua.1.gz /usr/share/man/man1/luac.1.gz
Most likely the above patch will break app_lua on other platform. We need a way to properly identify the proper lua lib that needs to be passed during the linking process.
That will, almost certainly, break lua compilation on non-CentOS distros as well as other platforms.
The correct way, at least on Linux (I don't personally do much cross-platform work), is to use pkg-config to both test for the correct version and get the linker flags.
The output on my Fedora workstation, for example:
[user@workstation]$ pkg-config --libs lua -llua -lm -ldl [user@workstation]$
Regards, - Brad