Page 1 of 1

cannot find -llualib on ubuntu

Posted: Fri Oct 06, 2006 4:34 pm
by Nowic
SVN: Revision 9879

=================
Desktop:
=================
OS: Debian GNU/Linux Etch (testing)
Gfx: Nvidia Geforce 3 Ti 200
Driver: nvidia-glx 1.0.8762

=================
Thinkpad T42:
=================
OS: Ubuntu Dapper Drake
Gfx: ATI Mobility Radeon 9600
Driver: X.org "ati" drivers 1:6.5.7.3

This is an error I fixed for myself long time ago... I thought it was an error on my system... but maybe it's an error in Orxonox's configure script. I don't really know. A friend reported exactly the same problem on his ubuntu machine... so I decided to post it.

On both sytems ./autogen.sh and ./configure run without errors. All available lua-dev packages are installed. But after all files are compiled, make stops:

Code: Select all

/usr/bin/ld cannot find -llualib
I googled for about an hour and found out that this seems to solve the problem:

Code: Select all

user@system:/usr/lib# ln -s  liblualib50.a liblualib.a
Apart from that everything seems to work.
Anyone else who experienced such problems on ubuntu?

Posted: Sat Oct 07, 2006 8:47 pm
by patrick
Thanks very much for the bugreport and fix! I will tell Bensch to look at this since he is in charge of the make files :D

cheers

Posted: Thu Oct 12, 2006 6:36 am
by bensch
I do not see the bug here. It may come from:
acinclude.m4 -> AX_CHECK_LUA
but it is quite cryptic :?
maybe it's just you, who sees it.

Posted: Sat Aug 04, 2007 9:43 pm
by Nowic
After I did ("frickel") some make files for some of my projects, I finaly have a clue how the 'autotools hell' works... more or less.

Here is a patch for the lua problem. I copied most of it from GNOME Hearts 0.1.3 (http://www.gnomefiles.org/app.php/Hearts). They had exactly the same problem.

Code: Select all

Index: configure.ac
===================================================================
--- configure.ac        (Revision 10772)
+++ configure.ac        (Arbeitskopie)
@@ -501,12 +501,11 @@
 # FFmpeg #
 #--------#

-## THIS IS FOR SURE A BUG (-llualib)
 # checking for FFmpeg-headers
   AX_CHECK_REQUIRED_HEADER_LIB([avformat.h ffmpeg/avformat.h] ,[avformat], [main],
    [AX_CHECK_REQUIRED_HEADER_LIB([avcodec.h ffmpeg/avcodec.h], [avcodec], [main],,, [http://ffmpeg.sourceforge.net]) LIBS="${LIBS} -lavformat -lavcodec"],
      [AX_GET_INSTALL_NECESSARY_LIB([http://svn.orxonox.net/webdev/develop/ext_libs], [ffmpeg.tar.gz], [ffmpeg], [extern_libs/], [include/*.h lib/*.a])
-       LIBS="-llualib -llua"  CPPFLAGS="${CPPFLAGS} -I$(top_build_dir)/extern_libs" ],
+       CPPFLAGS="${CPPFLAGS} -I$(top_build_dir)/extern_libs" ],
   [http://ffmpeg.sourceforge.net])


@@ -590,9 +589,35 @@
 #-----#
 # LUA #
 #-----#
-LUA_DIR="/usr/include/lua"
-AX_CHECK_LUA([${LUA_DIR}])
+# strange Lua fix from GNOME Hearts 0.1.3, because it's liblua50 on Debian and liblua (with no .pc file) everywhere else
+PKG_CHECK_MODULES(LUA, [lua50, lualib50], [], [
+  AC_CHECK_LIB(lua, lua_open, LIB_LUA=-llua)
+  AC_CHECK_LIB(lualib, luaopen_base, LIB_LUA_LIB=-llualib, , [$LIB_LUA -ldl -lm])
+
+  if test "x${LIB_LUA}" = "x"; then
+    echo "Could not find liblua. Please install liblua 5.0"
+    exit 1
+  fi

+  if test "x${LIB_LUA_LIB}" = "x"; then
+    echo "Could not find liblualib. Please install liblualib 5.0"
+    exit 1
+  fi
+
+  LUA_INT=`lua -e "print(_VERSION)" | awk '/Lua/ {split($2, VERSION, "."); printf "%d\n", VERSION[[1]] * 100 + VERSION[[2]];}'`
+  if test $LUA_INT -ne 500; then
+    echo "Wrong Lua version found. You need Lua 5.0. Note: Orxonox will not work with Lua 5.1"
+    exit 1
+  fi
+
+  LUA_CFLAGS=
+  LUA_LIBS="$LIB_LUA $LIB_LUA_LIB"
+])
+AC_SUBST(LUA_CFLAGS)
+AC_SUBST(LUA_INCLUDES)
+AC_SUBST(LUA_LIBS)
+CPPFLAGS="$CPPFLAGS $LUA_CFLAGS"
+
 #--------#
 # efence #
 #--------#
So the dirty hack from above isn't needed anymore. It's tested with Debian Etch and Ubuntu Feisty and it should be tested on other distros too before inclusion.
There is one cosmetic error on my system I couldn't solve: $LIB_LUA = -I/usr/include//lua50 (one slash would be enough, but it works anyway.) Any ideas? Maybe a debian bug...

This patch should also solve this bug: viewtopic.php?t=117
because configure enforces Lua 5.0.x. But that can be chanced easily in the future when we support Lua 5.1.x.

nowic

@bensch: AX_CHECK_LUA would be removed. I have no clue what that does ;)

Posted: Mon Aug 06, 2007 8:46 am
by patrick
Awesome! Thanks very much. I, personally, have no clue about autoconf :D