Bug 198048

Summary: stratagus build and run issues in devel
Product: [Fedora] Fedora Reporter: Patrice Dumas <pertusus>
Component: stratagusAssignee: Peter Lemenkov <lemenkov>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: extras-qa, hdegoede
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2006-12-21 20:46:05 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 213321    
Attachments:
Description Flags
diff for the specfil to include the paches and run autoconf
none
patch to add -ld to link with lua and search lualib symbol in lua
none
lua_getgccount seems not to be in lua so I removed the code
none
PATCH fixing stratagus 2.1 with lua 5.1
none
PATCH: fixing bos
none
Updated patch to fix backtraces when lua errors are thrown
none
Patch fixing bos 2.0.1 none

Description Patrice Dumas 2006-07-08 15:23:31 UTC
Description of problem:

The current stratagus 0:2.1-5.fc6 segfaults in devel with
battle of survival (bos_1_1).

I tried to recompile it from cvs specfile, but it failed. I
managed to get it build, but it crashes even sooner! I'll
attach a diff to the specfile and the patches that allowed 
me to have stratagus built.

[dumas@localhost bos_1_1]$ stratagus .
Battle of Survival default config file loading ...

error in error handling


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:

Comment 1 Patrice Dumas 2006-07-08 15:25:10 UTC
Created attachment 132109 [details]
diff for the specfil to include the paches and run autoconf

Comment 2 Patrice Dumas 2006-07-08 15:28:02 UTC
Created attachment 132110 [details]
patch to add -ld to link with lua and search lualib symbol in lua

Comment 3 Patrice Dumas 2006-07-08 15:29:29 UTC
Created attachment 132111 [details]
lua_getgccount seems not to be in lua so I removed the code

Comment 4 Peter Lemenkov 2006-09-16 11:02:51 UTC
Fixed compilation with new Lua. 

Comment 5 Patrice Dumas 2006-10-22 10:50:54 UTC
Still don't work with battle of survival (including pre version):

[dumas@localhost bos_1_1]$ stratagus
Battle of Survival default config file loading ...

Can't open file: No such file or directory
error in error handling


[dumas@localhost bos_1_1pre1]$ stratagus
Battle of Survival default config file loading ...

Can't open file: No such file or directory
error in error handling



Comment 6 Hans de Goede 2006-11-14 23:08:18 UTC
Created attachment 141196 [details]
PATCH fixing stratagus 2.1 with lua 5.1

Hi all,

I've spend some hours debugging this and I now know what the problem is and
howto fix this.

The "error in error handling" error is because stratagus tries to pass lua's
internal backtrace generator as errfunc when making lua calls from C, however
this is done in a way which breaks with lua-5.1, this patch fixes this.

With this fixed a stacktrace gets generated and it becomes clear that there is
an error in the bos lua code, for which I'll attach a seperate patch shortly.

Besides that there is another problem in stratagus in src/ai/script_ai.c, where

it tries to get the lua-name of a lua-function and the code there results in
NULL being returned as name, this might have something todo with lua-5.1 too. I
didn't fix this as I didn't know how, and it isn't necesarry as that name is
only used in dead code (iow code which never gets called).

Then there is a third issue with: src/game/games.c: 352:
"ThisPlayer->Name = strdup(LocalPlayerName);"
where ThisPlayer gets used, but when Stratagus is not correctly started from
the cmdline ThisPlayer is NULL, leading to a crash. I guess we should give a
more friendly errormessage here, I'll leave this up to the package maintainer.

The correct way to invake stratagus from the bos_1_1 dir is:
"stratagus -d data maps/default.pud.gz"

With stratagus patched with this patch and bos patched with my to be attached
patch bos starts fine, I didn't play it as its bedtime now.

Notice that this is with stratagus 2.1, not SVN, I see no reason to move to
SVN.

Comment 7 Hans de Goede 2006-11-14 23:10:35 UTC
Created attachment 141198 [details]
PATCH: fixing bos

Comment 8 Hans de Goede 2006-11-14 23:11:43 UTC
p.s.

BOS itself seems opensource to at first glance, why isn't it packaged itself?


Comment 9 Hans de Goede 2006-11-16 19:51:44 UTC
Erm, ping? I've handed you the fix for this on a silver platter, after many
hours of debugging I might add some kinda response would be nice a fixed package
even better!


Comment 10 Peter Lemenkov 2006-11-16 20:32:01 UTC
All fixes applied now!
Looks like we got it work with Lua5.1.

Thanks a lot, Hans ).


Comment 11 Hans de Goede 2006-11-16 20:55:17 UTC
Cool,

Next time when you fix a bug which is in BZ, please add a the bz ticket number
to the changelog entry (and be a little more verbose), for example in this case
it would have been better to have this as changelog entry:

* Thu Nov 16 2006 Peter Lemenkov <lemenkov> 2.1-10
- Applied patches from Hans de Goede fixing running with lua-5.1 (bz 198048)

p.s.

Don't forget to close this bug once the builds have completed successfully.


Comment 12 Hans de Goede 2006-11-17 16:29:19 UTC
p.s.

Can you also send these fixes upstream please, they might find them usefull too.



Comment 13 Ruben Kerkhof 2006-12-21 20:24:25 UTC
Ping?

Peter, is it ok to close this bug? You fixed it on Nov 18.

Comment 14 Peter Lemenkov 2006-12-21 20:46:05 UTC
Oops!
Closing...

Comment 15 Hans de Goede 2006-12-22 07:27:59 UTC
p.s.

Peter you are aware that stratagus has a new 2.x release out? That probably
needs my patch too, atleast it wasn't in CVS last time I checked.

There also is a new bos out for use with the new stratagus, I still think we
should package bos.


Comment 16 Peter Lemenkov 2006-12-24 08:08:21 UTC
(In reply to comment #15)
> p.s.
> 
> Peter you are aware that stratagus has a new 2.x release out? That probably
> needs my patch too, atleast it wasn't in CVS last time I checked.

I can't compile stratagus-2.2.1 right out-of-the-box

g++ -c -DHAVE_CONFIG_H  -DUSE_OPENGL -DUSE_BZ2LIB -DUSE_VORBIS -DUSE_MIKMOD
-I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -DUSE_ZLIB -I. -I./src/include
-I./src/guichan/include -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -O2 -pipe -fsigned-char
-fomit-frame-pointer -fexpensive-optimizations -ffast-math src/tolua/tolua.cpp
-o src/tolua/obj/tolua.o
src/tolua/tolua.cpp: In function ‘int tolua_stratagus_open(lua_State*)’:
src/tolua/tolua.cpp:16152: error: ‘lua_dobuffer’ was not declared in this scope
src/tolua/tolua.cpp:16215: error: ‘lua_dobuffer’ was not declared in this scope
src/tolua/tolua.cpp:16463: error: ‘lua_dobuffer’ was not declared in this scope
src/tolua/tolua.cpp:16859: error: ‘lua_dobuffer’ was not declared in this scope
src/tolua/tolua.cpp:17059: error: ‘lua_dobuffer’ was not declared in this scope
make: *** [src/tolua/obj/tolua.o] Error 1
ошибка: Неверный код возврата из /var/tmp/rpm-tmp.38317 (%build)


Ошибки сборки пакетов:
    Неверный код возврата из /var/tmp/rpm-tmp.38317 (%build)
[petro@Sulaco SPECS]$

Also they ship custom versions of tolua++ and guichan with stratagus. I'll try
to use already availaible ion FE.

Comment 17 Peter Lemenkov 2006-12-24 08:39:10 UTC
OK, i got rid of internally shipping tolua++:

http://lemenkov.newmail.ru/other/stratagus/stratagus.spec
http://lemenkov.newmail.ru/other/stratagus/stratagus--use_external_tolua.diff

TODO:

* remove guichan

Unfortunately BoS cannot be started:

[petro@Sulaco bos_2_0_1]$ ./stratagus -d ./data.bos/
Battle of Survival default config file loading ...

[string "./data.bos//scripts/stratagus.lua"]:52: attempt to call a table value
stack traceback:
        [string "./data.bos//scripts/stratagus.lua"]:52: in main chunk
[petro@Sulaco bos_2_0_1]$ 

Comment 18 Peter Lemenkov 2006-12-24 08:41:26 UTC
Oops.
I forgot to add link to Hans de Goede's patch:

http://lemenkov.newmail.ru/other/stratagus/stratagus--use-lua51.diff

Comment 19 Hans de Goede 2007-01-24 11:09:01 UTC
Created attachment 146397 [details]
Updated patch to fix backtraces when lua errors are thrown

Just like the last time, there are 2 problems:
1) A couple of lua bugs in bos
2) Invalid traceback calling in stratagus making debugging harder

This updates patch fixes 2) I also have a patch for 1) which I will attach
next.
Any plans on packaging bos? That would be great as currently stratagus is a bit
useless to have.

Comment 20 Hans de Goede 2007-01-24 11:10:06 UTC
Created attachment 146398 [details]
Patch fixing bos 2.0.1

Comment 21 Peter Lemenkov 2007-01-24 21:08:06 UTC
OK, thanks - stratagus upgraded to 2.2.2. Although one TODO still exists (we
must use the FE-provided guichan instead of one shipped with stratagus) I
rebuild it for Devel, FC-6 and FC-5 branches.

Another one note - I submitted Battle of Survival for review:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=224254