bugBos Wars - Bugs: bug #40645, Detection of lua 5.1 on some RPM...

 
 

bug #40645: Detection of lua 5.1 on some RPM distros

Submitter:  Paul Dufresne <pauld>
Submitted:  Wed 20 Nov 2013 12:30:10 AM UTC
   
 
Severity:  3 - Normal Item Group:  * Feature Request
Status:  Fixed Privacy:  Public
Assigned to:  feb Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 07 Jul 2023 01:12:31 AM UTC, comment #19: 

Just reclone and rebuilt.
Work fine without modifications.
Thank you!

Now I don't know it this but should be about upgrading toward Lua 5.2, or consider it closed about 5.1 was not compiling by default on some distros.

Your shot!

I still have some interest in trying to port toward Lua 5.2, but frankly it seems less important now that it compile fine with 5.1.

Paul Dufresne <pauld>
Thu 06 Jul 2023 09:12:54 PM UTC, comment #18: 

Updated make.py in development version to also check for lua-5.1 for those distros.

Looking at some discussions of Wargus stratagus project, they looked at swithing to lua 5.2, but gave up.

Thank you for the feedback.

François Beerten <feb>
Group administrator
Wed 05 Jul 2023 02:34:37 AM UTC, comment #17: 

Stratagus install file still ask for Lua5.1:
https://htmlpreview.github.io/?https://raw.githubusercontent.com/Wargus/stratagus/master/doc/install.html

It use tolua++ that seems to suggest it is still limited to Lua 5.1 (for Windows it says:)
"The project has 4 different build options:
  withLua50_Release, withLua51_Release, withLua50_Debug and withLua51_Debug."
https://github.com/LuaDist/toluapp/blob/master/INSTALL

Paul Dufresne <pauld>
Wed 05 Jul 2023 01:24:29 AM UTC, comment #16: 

It seems that OpenSuse think you should do pkg-config(lua5.1) and Fedora, EPEL and Mageia think you should do pkg-config(lua-5.1):
https://rpmfind.net/linux/rpm2html/search.php?query=pkgconfig%28lua5.1%29&submit=Search+...&system=&arch=
https://rpmfind.net/linux/rpm2html/search.php?query=pkgconfig%28lua-5.1%29&submit=Search+...&system=&arch=

Paul Dufresne <pauld>
Tue 04 Jul 2023 06:00:22 PM UTC, comment #15: 

With the following, I was able to
./make.py debug
fbuild/debug/boswars

[paul@localhost boswars]$ git diff make.py
diff --git a/make.py b/make.py
index dd39ed46..b69b3cfc 100755
--- a/make.py
+++ b/make.py
@@ -275,7 +275,7 @@ def detectLua(b):
     # Prefer that because it will call our C++ destructors on unwind.
     # This avoids memory leaks that would be very cumbersome to fix in
     # any other way.
-    libs = 'lua5.1-c++ lua5.1 lua51 lua'.split()
+    libs = 'lua5.1-c++ lua-5.1 lua5.1 lua51 lua'.split()
     if b.usepkgconfig:
         for i in libs:
             if pkgconfig(b, i):
[paul@localhost boswars]$


Paul Dufresne <pauld>
Tue 04 Jul 2023 05:42:32 PM UTC, comment #14: 

make.py have:
"If e.g. pkg-config --cflags lua5.1 outputs:"
also:
"libs = 'lua5.1-c++ lua5.1 lua51 lua'.split()"

but my system seems to use lua-5.1, not lua5.1 (I think):

[paul@localhost boswars]$ pkg-config --libs lua5.1
Package lua5.1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `lua5.1.pc'
to the PKG_CONFIG_PATH environment variable
Package 'lua5.1', required by 'virtual:world', not found
[paul@localhost boswars]$
[paul@localhost boswars]$ pkg-config --cflags lua-5.1
-I/usr/include/lua-5.1
[paul@localhost boswars]$

All lua 5.1 packages:
lua5.1-basexx.noarch : BaseXX encoding and decoding library for Lua 5.1
lua5.1-binaryheap.noarch : Binary heap implementation for Lua 5.1
lua5.1-bit32.x86_64 : Lua 5.2 bit manipulation library
lua5.1-bitop.x86_64 : C extension module for Lua 5.1 which adds bit-wise
                    : operations on numbers
lua5.1-compat53.x86_64 : Compatibility module providing Lua-5.3-style APIs for
                       : Lua 5.1
lua5.1-cqueues.x86_64 : Stackable Continuation Queues for the Lua Programming
                      : Language 5.1
lua5.1-fifo.noarch : FIFO library for Lua 5.1
lua5.1-filesystem.x86_64 : File System Library for the Lua Programming Language
                         : 5.1
lua5.1-http.noarch : HTTP library for Lua
lua5.1-lpeg.x86_64 : Parsing Expression Grammars for Lua 5.1
lua5.1-luaossl.x86_64 : Most comprehensive OpenSSL module in the Lua universe
lua5.1-luv.x86_64 : Bare libuv bindings for lua 5.1
lua5.1-luv-devel.x86_64 : Development files for lua5.1-luv
lua5.1-mmdb.noarch : MaxMind database parser for Lua 5.1
lua5.1-mpack.x86_64 : Implementation of MessagePack for Lua 5.1

[root@localhost ~]# dnf list --installed|grep lua
compat-lua-devel.x86_64                          5.1.5-20.el9                                @epel                    
compat-lua-libs.x86_64                           5.1.5-20.el9                                @epel                    
lua.x86_64                                       5.4.4-3.el9                                 @System                  
lua-devel.x86_64                                 5.4.4-3.el9                                 @crb                     
lua-libs.x86_64                                  5.4.4-3.el9                                 @System                  
lua-rpm-macros.noarch                            1-6.el9                                     @appstream               
lua-srpm-macros.noarch                           1-6.el9                                     @appstream               
[root@localhost ~]#

Paul Dufresne <pauld>
Mon 03 Jul 2023 11:35:15 AM UTC, comment #13: 

The effort to port to Lua 5.2 is in the patch tracker (https://savannah.nongnu.org/patch/?8600). It had issues mostly with tolua++.

Maybe the Wargus Stratagus engine managed to upstep to Lua 5.2 and could give clues on how to do it.

François Beerten <feb>
Group administrator
Mon 03 Jul 2023 11:32:06 AM UTC, comment #12: 


comment #5:

> I tried to compile latest git version here on AlmaLinux, but it #include <lua.h> where to work it would need to #include <lua-5.1/lua.h>.
>
> I have tried to create a new issue, it does not seems to appears up to now... maybe it need time, or I missed something.


Changing to #include <lua-5.1/lua.h> will break many other distros and is actually not needed. The build system tries to detect the location of Lua headers. Does your distro have a pkgconfig for lua 5.1 ?

François Beerten <feb>
Group administrator
Sun 02 Jul 2023 12:54:12 AM UTC, comment #11: 

Stupidly applying some recipes from https://stackoverflow.com/questions/28332452/porting-from-lua-5-1-to-5-2

But harder cases not touched, so still getting:

g++ -c engine/game/trigger.cpp -o fbuild/debug/trigger.o -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include -g -Werror -DDEBUG
engine/game/trigger.cpp: In function ‘int CclAddTrigger(lua_State*)’:
engine/game/trigger.cpp:569:33: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  569 |                 lua_settable(l, LUA_GLOBALSINDEX);
      |                                 ^~~~~~~~~~~~~~~~
engine/game/trigger.cpp: In function ‘void CleanTriggers()’:
engine/game/trigger.cpp:786:27: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  786 |         lua_settable(Lua, LUA_GLOBALSINDEX);
      |                           ^~~~~~~~~~~~~~~~
fabricate: 'strace' exited with status 1
[paul@localhost boswars]$


Paul Dufresne <pauld>
Sat 01 Jul 2023 08:34:55 PM UTC, comment #10: 

I have tried to do some work toward Lua 5.2.

I am trying to attach my 2 patches to this comment... not sure at all I am doing it right.

But I still get harder changes to do:
[paul@localhost boswars]$ LANG=C ./make.py
g++ fbuild/release/conftests/testvorbis.c -o fbuild/release/conftests/testvorbis -lz -lGL -lSDL -lX11 -llua -lm -ldl -lpng -lvorbis -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include
/usr/bin/ld: cannot find -lvorbis
collect2: error: ld returned 1 exit status
g++ fbuild/release/conftests/testtheora.c -o fbuild/release/conftests/testtheora -lz -lGL -lSDL -lX11 -llua -lm -ldl -lpng -ltheora -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include
/usr/bin/ld: cannot find -ltheora
collect2: error: ld returned 1 exit status
g++ fbuild/release/conftests/testogg.c -o fbuild/release/conftests/testogg -lz -lGL -lSDL -lX11 -llua -lm -ldl -lpng -logg -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include
/usr/bin/ld: cannot find -logg
collect2: error: ld returned 1 exit status
g++ -c engine/game/trigger.cpp -o fbuild/release/trigger.o -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include -O2
engine/game/trigger.cpp: In function ‘int CclAddTrigger(lua_State*)’:
engine/game/trigger.cpp:563:25: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  563 |         lua_gettable(l, LUA_GLOBALSINDEX);
      |                         ^~~~~~~~~~~~~~~~
engine/game/trigger.cpp: In function ‘void TriggersEachCycle()’:
engine/game/trigger.cpp:674:27: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  674 |         lua_gettable(Lua, LUA_GLOBALSINDEX);
      |                           ^~~~~~~~~~~~~~~~
engine/game/trigger.cpp: In function ‘void SaveTriggers(CFile*)’:
engine/game/trigger.cpp:735:27: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  735 |         lua_gettable(Lua, LUA_GLOBALSINDEX);
      |                           ^~~~~~~~~~~~~~~~
engine/game/trigger.cpp: In function ‘void InitTriggers()’:
engine/game/trigger.cpp:775:27: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  775 |         lua_gettable(Lua, LUA_GLOBALSINDEX);
      |                           ^~~~~~~~~~~~~~~~
engine/game/trigger.cpp: In function ‘void CleanTriggers()’:
engine/game/trigger.cpp:791:27: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  791 |         lua_settable(Lua, LUA_GLOBALSINDEX);
      |                           ^~~~~~~~~~~~~~~~
fabricate: 'strace' exited with status 1
[paul@localhost boswars]$



(file #54906, file #54907)

Paul Dufresne <pauld>
Sat 01 Jul 2023 11:39:49 AM UTC, comment #9: 

Actually, more replace lua_getfield(Lua, LUA_GLOBALSINDEX, "AiTypes") by lua_getglobal(Lua, "AiTypes") according to https://stackoverflow.com/questions/11093189/lua-updating-from-5-1-lua-globalsindex-problems. But i guess there will be more serious porting problems.

So probably better to change #include <lua.h> to #include <lua-5.1/lua.h> ... but then I guess it would break some distributions.

Paul Dufresne <pauld>
Sat 01 Jul 2023 11:31:48 AM UTC, comment #8: 

Instead of lua_settable(L,LUA_GLOBALSINDEX); use lua_setglobal(L,T::className);. That works in both Lua 5.1 and 5.2.

taken from: https://stackoverflow.com/questions/9057943/porting-to-lua-5-2-lua-globalsindex-trouble


Paul Dufresne <pauld>
Sat 01 Jul 2023 11:21:02 AM UTC, comment #7: 

I now get:
g++ -c engine/ai/ai.cpp -o fbuild/debug/ai.o -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include -g -Werror -DDEBUG
engine/ai/ai.cpp: In function ‘void AiExecuteFunction(const char*)’:
engine/ai/ai.cpp:163:35: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  163 |                 lua_getfield(Lua, LUA_GLOBALSINDEX, "AiTypes");
      |                                   ^~~~~~~~~~~~~~~~
engine/ai/ai.cpp: In function ‘void AiInit(CPlayer*)’:
engine/ai/ai.cpp:495:27: error: ‘LUA_GLOBALSINDEX’ was not declared in this scope
  495 |         lua_getfield(Lua, LUA_GLOBALSINDEX, "AiState"); // stack: AiState
      |                           ^~~~~~~~~~~~~~~~
fabricate: 'strace' exited with status 1
[paul@localhost boswars]$

which seems similar to what I was getting in 2013.

Paul Dufresne <pauld>
Sat 01 Jul 2023 11:17:19 AM UTC, comment #6: 

Actually, I just installed lua-devel package, which install /usr/include/lua.h, but it is version 5.4.4.

Paul Dufresne <pauld>
Sat 01 Jul 2023 11:01:05 AM UTC, comment #5: 

I tried to compile latest git version here on AlmaLinux, but it #include <lua.h> where to work it would need to #include <lua-5.1/lua.h>.

I have tried to create a new issue, it does not seems to appears up to now... maybe it need time, or I missed something.

Paul Dufresne <pauld>
Thu 22 Jun 2023 07:45:53 AM UTC, comment #4: 

Also BosWars works with Lua 5.1 and not 5.2. There was an attempts to port to Lua 5.2 but it did succeed yet.

François Beerten <feb>
Group administrator
Thu 22 Jun 2023 07:44:15 AM UTC, comment #3: 

Can you give it a try with the latest development version on Codeberg ? By the way, BosWars migrated to Git.

François Beerten <feb>
Group administrator
Sun 09 Feb 2014 12:57:33 PM UTC, comment #2: 

There's often grass in the battefield. Sometimes sand or rocks, but not black matter. Does it work now ? Did you try with OpenGL disabled ?

François Beerten <feb>
Group administrator
Wed 20 Nov 2013 01:23:50 AM UTC, comment #1: 

Sorry, but current PKGBUILD file in ArchLinux AUR is getting an old revision: 10083.

By changing the line from:
pkgver=10083
to:
pkgver=10225

before issueing makepkg command, I am now able to build the package fine and play with it.

My only surprise is the black background... was remembering grass.

Paul Dufresne <pauld>
Wed 20 Nov 2013 12:30:10 AM UTC, original submission:  

I am/was trying to compile boswars on Arch Linux with AUR package at: https://aur.archlinux.org/packages/boswars-svn/

I get:
======
At revision 10083.
g++ -c engine/stratagus/script.cpp -o fbuild/release/script.o -Wall -fsigned-char -D_GNU_SOURCE=1 -D_REENTRANT -I/usr/include/SDL -DHAVE_STRCASESTR -DHAVE_STRNLEN -DHAVE_X -Iengine/include -Iengine/guichan/include -DUSE_VORBIS -DUSE_THEORA -DUSE_OGG -O2
engine/stratagus/script.cpp: In function 'int luatraceback(lua_State*)':
engine/stratagus/script.cpp:148:18: error: 'LUA_GLOBALSINDEX' was not declared in this scope
lua_gettable(L, LUA_GLOBALSINDEX);
^
engine/stratagus/script.cpp: In function 'char* SaveGlobal(lua_State*, bool)':
engine/stratagus/script.cpp:1032:19: error: 'LUA_GLOBALSINDEX' was not declared in this scope
lua_gettable(l, LUA_GLOBALSINDEX);
^
engine/stratagus/script.cpp: In function 'void SavePreferences()':
engine/stratagus/script.cpp:1188:20: error: 'LUA_GLOBALSINDEX' was not declared in this scope
lua_gettable(Lua, LUA_GLOBALSINDEX);
^
fabricate: 'g++' exited with status 1
=====

http://lists.opensuse.org/opensuse-factory/2012-01/msg00265.html suggest that it could be because boswars need lua5.1 not lua5.2

Fedora seems to have applied the following patch to build with Lua 5.2:
http://web.archiveorange.com/archive/v/NUQmuzfEW27NeGJ82aVD

Probably, a good fix would change the function detectLua in make.py, and would detect if the system have Lua 5.1, 5.2 or both, and define some symbols, to allow building the program in the two cases.

That said, I don't feel I know enough to make such a contribution.

Paul Dufresne <pauld>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #54908:  0001-doing-recipe-settable-and-gettable-with-LUA_GLOBALIN.patch added by pauld (2KiB - text/x-patch - Seem I missed the patch for previous comment)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by feb (Posted a comment)
  • -email is unavailable- added by pauld (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-06 feb StatusNeed Info Fixed
        Open/ClosedOpen Closed
        Summaryboswars should compile with Lua 5.2 Detection of lua 5.1 on some RPM distros
    2023-07-02 pauld Attached File- Added 0001-doing-recipe-settable-and-gettable-with-LUA_GLOBALIN.patch, #54908
    2023-07-01 pauld Attached File- Added 0001-replace-some-lua_getfield-by-lua_getglobal.patch, #54906
        Attached File- Added 0002-replace-some-lua_objlen-by-lua_rawlen.patch, #54907
    2023-06-22 feb StatusNone Need Info
        Assigned toNone feb

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code