Bug 198048 - stratagus build and run issues in devel
stratagus build and run issues in devel
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: stratagus (Show other bugs)
rawhide
All Linux
medium Severity medium
: ---
: ---
Assigned To: Peter Lemenkov
Fedora Extras Quality Assurance
:
Depends On:
Blocks: FE7Target
  Show dependency treegraph
 
Reported: 2006-07-08 11:23 EDT by Patrice Dumas
Modified: 2007-11-30 17:11 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-12-21 15:46:05 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
diff for the specfil to include the paches and run autoconf (877 bytes, patch)
2006-07-08 11:25 EDT, Patrice Dumas
no flags Details | Diff
patch to add -ld to link with lua and search lualib symbol in lua (1.34 KB, text/x-patch)
2006-07-08 11:28 EDT, Patrice Dumas
no flags Details
lua_getgccount seems not to be in lua so I removed the code (624 bytes, text/x-patch)
2006-07-08 11:29 EDT, Patrice Dumas
no flags Details
PATCH fixing stratagus 2.1 with lua 5.1 (2.33 KB, patch)
2006-11-14 18:08 EST, Hans de Goede
no flags Details | Diff
PATCH: fixing bos (628 bytes, patch)
2006-11-14 18:10 EST, Hans de Goede
no flags Details | Diff
Updated patch to fix backtraces when lua errors are thrown (1.92 KB, patch)
2007-01-24 06:09 EST, Hans de Goede
no flags Details | Diff
Patch fixing bos 2.0.1 (2.30 KB, patch)
2007-01-24 06:10 EST, Hans de Goede
no flags Details | Diff

  None (edit)
Description Patrice Dumas 2006-07-08 11:23:31 EDT
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 11:25:10 EDT
Created attachment 132109 [details]
diff for the specfil to include the paches and run autoconf
Comment 2 Patrice Dumas 2006-07-08 11:28:02 EDT
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 11:29:29 EDT
Created attachment 132111 [details]
lua_getgccount seems not to be in lua so I removed the code
Comment 4 Peter Lemenkov 2006-09-16 07:02:51 EDT
Fixed compilation with new Lua. 
Comment 5 Patrice Dumas 2006-10-22 06:50:54 EDT
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 18:08:18 EST
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 18:10:35 EST
Created attachment 141198 [details]
PATCH: fixing bos
Comment 8 Hans de Goede 2006-11-14 18:11:43 EST
p.s.

BOS itself seems opensource to at first glance, why isn't it packaged itself?
Comment 9 Hans de Goede 2006-11-16 14:51:44 EST
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 15:32:01 EST
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 15:55:17 EST
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@gmail.com> 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 11:29:19 EST
p.s.

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

Comment 13 Ruben Kerkhof 2006-12-21 15:24:25 EST
Ping?

Peter, is it ok to close this bug? You fixed it on Nov 18.
Comment 14 Peter Lemenkov 2006-12-21 15:46:05 EST
Oops!
Closing...
Comment 15 Hans de Goede 2006-12-22 02:27:59 EST
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 03:08:21 EST
(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 03:39:10 EST
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 03:41:26 EST
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 06:09:01 EST
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 06:10:06 EST
Created attachment 146398 [details]
Patch fixing bos 2.0.1
Comment 21 Peter Lemenkov 2007-01-24 16:08:06 EST
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


Note You need to log in before you can comment on or make changes to this bug.