Page 1 of 2

Problems with lua

Posted: 07.10.2006, 18:02
by cartrite
The configure script failed to run while trying to build Celestia cvs 10/07 on Suse 10 with lua 5.0.2 installed. I had to install lua 5.1.1. After that, no problems.

cartrite

Posted: 09.10.2006, 08:13
by Christophe
I made changes to the way Lua is detected and I enabled support for Lua 5.1, but systems with only Lua 5.0 should still be working. Can you report what 'locate lua*.pc' returns on your system?

Posted: 09.10.2006, 11:41
by cartrite
I ran locate lua.pc twice. Once for each version. 5.0.2 and 5.1.1 The output looked the same.
linux:/home/cartrite/bin/celestia/backup/lua-5.0.2 # locate lua*.pc
linux:/home/cartrite/bin/celestia/backup/lua-5.0.2 # locate lua.pc
/home/cartrite/bin/celestia/backup/lua-5.1.1/etc/lua.pc
/home/cartrite/bin/celestia/backup/lua.pc
/root/.kde/share/apps/RecentDocuments/lua.pc.desktop
/usr/local/lib/pkgconfig/lua.pc
linux:/home/cartrite/bin/celestia/backup/lua-5.0.2

The lua.pc I had in usr/local/lib/pkgconfig for 5.0.2

Code: Select all

# lua.pc -- pkg-config data for Lua
prefix= /usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Lua
Description: An Extensible Extension Language
Version: 5.0.2
Requires:
Libs: -L${libdir} -llua -llualib
Cflags: -I${includedir}


The lua.pc I had in usr/local/lib/pkgconfig for 5.1.1

Code: Select all

# lua.pc -- pkg-config data for Lua

# vars from install Makefile

# grep '^V=' ../Makefile
V= 5.1
# grep '^R=' ../Makefile
R= 5.1.1

# grep '^INSTALL_.*=' ../Makefile | sed 's/INSTALL_TOP/prefix/'
prefix= /usr/local
INSTALL_BIN= ${prefix}/bin
INSTALL_INC= ${prefix}/include
INSTALL_LIB= ${prefix}/lib
INSTALL_MAN= ${prefix}/man/man1
INSTALL_LMOD= ${prefix}/share/lua/${V}
INSTALL_CMOD= ${prefix}/lib/lua/${V}

# canonical vars
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua -lm
Cflags: -I${includedir}

# (end of lua.pc)


What looks like happened was I didn't have the versions info in the 5.0.2 lua.pc.

Code: Select all

V= 5.0
R= 5.0.2
......
Version: ${R}   
5.0.2 didn't have a lua.pc so it was created. 5.1.1 had one but had to be installed manually. Both were built from source.
If you want, I could reinstall 5.0.2 and capture the configure output on the terminal when it fails.

cartrite

Posted: 09.10.2006, 12:51
by cartrite
checking for lua5.1 >= 5.1.0... checking for lua >= 5.1.0... checking for lualib50 lua50 >= 5.0.0... checking for lualib lua >= 5.0.0... Package lualib was not found in the pkg-config search path. Perhaps you should add the directory containing `lualib.pc' to the PKG_CONFIG_PATH environment variable No package 'lualib' found
configure: error: Library requirements (lualib lua >= 5.0.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.

I wrote:
What looks like happened was I didn't have the versions info in the 5.0.2 lua.pc.
Code:
V= 5.0
R= 5.0.2
......
Version: ${R}
That didn't work. Configure still failed.

With 5.1.1 installed:
checking for lua5.1 >= 5.1.0... checking for lua >= 5.1.0... yes
checking LUA_CFLAGS... -I/usr/local/include
checking LUA_LIBS... -L/usr/local/lib -llua -lm
configure: creating ./config.status

Posted: 09.10.2006, 19:38
by Christophe
Ok, your problem is that you don't have a lualib.pc file. The problem is that since pkg-config support wasn't included in the official lua 5.0, implementation may vary from system to system...

Here is the one provided with Ubuntu 6.10:

Code: Select all

prefix=/usr
exec_prefix=/usr
libdir=/usr/lib
includedir=/usr/include/

Name: lua50
Description: The Lua 5.0 programming language addon libraries
Version: 5.0.0
Requires: lua50
Libs: -L${libdir} -llualib50
Cflags: -I${includedir}/lua50

Posted: 09.10.2006, 19:46
by cartrite
Christophe wrote:
Ok, your problem is that you don't have a lualib.pc file.
I did have a lua.pc file. It just wasn't called lualib.pc It worked before the changes. See here: http://www.celestiaproject.net/forum/viewtopic ... 7067#77067

Code: Select all

 # lua.pc -- pkg-config data for Lua
prefix= /usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

Name: Lua
Description: An Extensible Extension Language
Version: 5.0.2

Requires:
Libs: -L${libdir} -llua -llualib
Cflags: -I${includedir}


Anyhow everything works fine with 5.1.1 installed.

cartrite

Posted: 09.10.2006, 19:56
by Christophe
Everything may build correctly with lua 5.1, but as reported by Hank, 5.1 is not backward compatible with 5.0, so celx scripts may not work correctly with 5.1.

Posted: 09.10.2006, 20:07
by cartrite
I think my main problem is that I never used it. I never enabled it till I had too. Well I could have used --without-lua but I was trying to figure out what I needed to get it to work after it was enabled by default. Is anyone else having a similar problem? If there is I'll try to get it working with 5.0.2 and report here if I succeed. Otherwise I'll be happy that 5.1.1 works and go from there. If I understand you correctly, since I never wrote any celx scripts with 5.0.2, if I write any with 5.1.1 they'll work?


cartrite

Posted: 09.10.2006, 20:35
by phoenix
no I think he meant celx scripts probably won't work if celestia was compiled with lua 5.1.x but I also don't know why it shouldn't :?:

as far as I know celx scripts are not related to the lua version.
you can't write 2 different versions of celx for lua50 or lua51 ... its all the same isn't it?

but hank would really be the most qualified person to solve this problem ;)

Posted: 09.10.2006, 20:42
by cartrite
I don't have any celx scripts that were written with lua 5.0.2. Scripts written with lua 5.1.1 should work. But scripts written with 5.0.2 will not if 5.1.1 is installed. That's what I think. I may be wrong. But if scripts written with lua 5.1.1 don't work, then why is configure looking for version 5.1.1 in the first place.

Posted: 09.10.2006, 20:51
by Christophe
Scripts writen for lua 5.0 may not work with lua 5.1. Contrary to what the minor version bump implies, there are differences in the language and the libraries.

The problem is not with scripts you may write, but with scripts you get from other Celestia users, from the Motherlode for example.

Conversely, if you write celx scripts targeting lua 5.1 they will work for you, but they won't be "real" celx scripts since by definition celx uses lua 5.0 and not 5.1.

Posted: 09.10.2006, 21:01
by Christophe
cartrite wrote:But if scripts written with lua 5.1.1 don't work, then why is configure looking for version 5.1.1 in the first place.


Because I didn't know of that incompatibility when I modified the configure script!

I'm still not sure what is the best way to handle this. Enabling lua 5.1 even if it's not 100% compatible seems better than no celx support at all for systems without lua 5.0. Or we could version celx... This lack of backward compatibility really is annoying.

Posted: 09.10.2006, 21:02
by cartrite
OK I'm going to wait to see if anyone else has a problem. I'll also keep that in mind if I decide to use other celx scripts. I assume the proper libraries are in win-libs for the Win builds. Is Lua enabled by default for Windows? If it isn't, the setups I provided will not have Lua enabled. I will have to make a note of that on the thread that provides the links.

EDIT: I seen the celx.o file in the Release folder so I guess it was built with Lua on.

Posted: 10.10.2006, 02:38
by cartrite
I changed configure.in from

Code: Select all

if (test "$enable_lua" != "no"); then
   LUA_VER=0
   PKG_CHECK_MODULES(LUA, lualib50 lua50 = 5.0.0, LUA_VER=0x050000,
      [ PKG_CHECK_MODULES(LUA, lualib lua = 5.0.0, LUA_VER=0x050000,
        [ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.0, LUA_VER=0x050100,
          [ PKG_CHECK_MODULES(LUA, lua >= 5.1.0, LUA_VER=0x050100) ]
          ) ]
      ) ]
   )

To

Code: Select all

if (test "$enable_lua" != "no"); then
   LUA_VER=0
   PKG_CHECK_MODULES(LUA, lualib lua >= 5.0.0, LUA_VER=0x050000,
      [ PKG_CHECK_MODULES(LUA, lualib50 lua50 >= 5.0.0, LUA_VER=0x050000,
        [ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.0.2, LUA_VER=0x050000,
          [ PKG_CHECK_MODULES(LUA, lua >= 5.0.2, LUA_VER=0x050000) ]
          ) ]
      ) ]
   )

With 5.0.2 installed the original configure.in failed.
checking for lualib lua >= 5.0.0... checking for lualib50 lua50 >= 5.0.0... checking for lua5.1 >= 5.1.0... checking for lua >= 5.1.0... Requested 'lua >= 5.1.0' but version of Lua is 5.0.2
configure: error: Library requirements (lua >= 5.1.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them.
For some reason it sees 5.0.2 but wants 5.1.1.
The modified configure.in passed
checking for lualib lua >= 5.0.0... checking for lualib50 lua50 >= 5.0.0... checking for lua5.1 >= 5.0.2... checking for lua >= 5.0.2... yes
checking LUA_CFLAGS...
checking LUA_LIBS... -L/usr/local/lib -llua -llualib -lm
configure: creating ./config.status

This was the newest file updated a couple of hours ago on 10/9/06 about 9PM.
Is something wrong with configure.in or is something wrong with my system?

After, I ran HuygensMissionTour.celx V1.0 by Adirondack and everything looked good. A pretty cool script by the way. Looks like I was missing something. When I get time, I'll have to watch the whole thing.

cartrite

Posted: 10.10.2006, 06:15
by cartrite
Christophe,
Will this work. Original line 400

Code: Select all

if (test "$enable_lua" != "no"); then
   LUA_VER=0
   PKG_CHECK_MODULES(LUA, lualib50 lua50 = 5.0.0, LUA_VER=0x050000,
      [ PKG_CHECK_MODULES(LUA, lualib lua = 5.0.0, LUA_VER=0x050000,
        [ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.0, LUA_VER=0x050100,
          [ PKG_CHECK_MODULES(LUA, lua >= 5.1.0, LUA_VER=0x050100) ]
          ) ]
      ) ]
   )

Modified

Code: Select all

if (test "$enable_lua" != "no"); then
   LUA_VER=0
   PKG_CHECK_MODULES(LUA, lualib50 lua50 >= 5.0.0, LUA_VER=0x050000,
      [ PKG_CHECK_MODULES(LUA, lua >= 5.0.0, LUA_VER=0x050000,
        [ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.0, LUA_VER=0x050100,
          [ PKG_CHECK_MODULES(LUA, lua >= 5.1.0, LUA_VER=0x050100) ]
          ) ]
      ) ]
   )

Ihad lua 5.0.2 instaled in /usr/local and lua 5.1.1 in /usr/local/lua and configure chose lua 5.0.2. Eveything ran including Adirondack's script HuygensMissionTour.celx V1.0. I changed the = to >= and took out lualib from the second lua check. Mabey the lualib50 could be taken out too?

cartrite

Posted: 10.10.2006, 12:30
by Christophe
See my post dated '09/10/2006 21:38', the problem is that you don't have lualib.pc, and this is required (at least) on Ubuntu systems.

I'll look into it some more tonight, to see if I can work around this.

Posted: 10.10.2006, 12:33
by cartrite
Christophe,
I guess I was misunderstanding you yesterday.
Ok, your problem is that you don't have a lualib.pc file.
I now have 2 files in /usr/local/lib/pkgconfig. lua.pc and lualib.pc. EDIT Both files point to the same libs. /EDIT This works with version 5.0.2.
The change you made to configure.in had to be changed though I added >. Was there a reason for only accepting 5.0.0 ?
FROM

Code: Select all

if (test "$enable_lua" != "no"); then
   LUA_VER=0
   PKG_CHECK_MODULES(LUA, lualib50 lua50 = 5.0.0, LUA_VER=0x050000,
      [ PKG_CHECK_MODULES(LUA, lualib lua = 5.0.0, LUA_VER=0x050000,
        [ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.0, LUA_VER=0x050100,
          [ PKG_CHECK_MODULES(LUA, lua >= 5.1.0, LUA_VER=0x050100) ]
          ) ]
      ) ]
   )

TO:

Code: Select all

if (test "$enable_lua" != "no"); then
   LUA_VER=0
   PKG_CHECK_MODULES(LUA, lualib50 lua50 >= 5.0.0, LUA_VER=0x050000,
      [ PKG_CHECK_MODULES(LUA, lualib lua >= 5.0.0, LUA_VER=0x050000,
        [ PKG_CHECK_MODULES(LUA, lua5.1 >= 5.1.0, LUA_VER=0x050100,
          [ PKG_CHECK_MODULES(LUA, lua >= 5.1.0, LUA_VER=0x050100) ]
          ) ]
      ) ]
   )

Everything still worked like it did in my previous post.
http://www.celestiaproject.net/forum/viewtopic ... 9091#79091

I was writing this post just as you posted
See my post dated '09/10/2006 21:38', the problem is that you don't have lualib.pc, and this is required (at least) on Ubuntu systems.
Good timing AAA. :wink:

cartrite

Posted: 10.10.2006, 16:46
by hank
Lua 5.1 introduced a number of incompatiblities with Lua 5.0. There are incompatibilities in the language, the libraries, and the C API. A complete list is included in the Lua 5.1 reference manual. Most of these incompatibilities can be avoided by compiling Lua 5.1 with the appropriate configuration options, but these compatibility options will all be removed in the next version of Lua.

The Lua 5.1 incompatibilities are fairly limited and probably would not create problems for Celestia itself or for most .celx scripts. There would be some advantages in moving Celestia to Lua 5.1 at some point. But I don't think it's a good idea for the version of Lua supported in Celestia to be an environmental variable. I think all variants of a given version of Celestia should use the same verson of Lua.

- Hank

Posted: 10.10.2006, 17:03
by cartrite
I think I understand about 5.1 issues. Christophe is trying to have configure chose 5.0 if both are installed on a system. I installed both to see if this is working. The way configure.in worked last night was it was only accepting 5.0.0. I can install that. But I have 5.0.2 currently installed. My question now is if 5.0.2 is a problem. Adirondack's script HuygensMissionTour.celx V1.0 works good. So far that's the only one I tested. I want to see if this is alright with using 5.0.2 and what the final version of configure.in will be so I can stop playing with this.

cartrite

Posted: 10.10.2006, 17:15
by Malenfant
(would this thread not be better off in Developer Talk or on the Development board?)