Wargus / wargus

Importer and scripts for Warcraft II: Tides of Darkness, the expansion Beyond the Dark Portal, and Aleonas Tales
GNU General Public License v2.0
355 stars 55 forks source link

Failed to load game data. Fresh build from master on Fedora 35. Warcraft II BNE. #394

Closed ghost closed 2 years ago

ghost commented 2 years ago

Describe the bug I built Stratagus and Wargus from a fresh git clone on Fedora 35, and ran Wargus. I pointed it at the install.exe from my BNE cd. Running Wargus after the extraction process, it fails to run with an error.

To Reproduce Steps to reproduce the behavior:

  1. Install dependencies:
    sudo dnf install compat-lua-5.1*
    sudo dnf install compat-lua-devel-5.1*
    sudo dnf install libpng-devel
    sudo dnf install SDL2*-devel
    sudo dnf install tolua++*
    sudo dnf install bzip2-devel
    sudo dnf install ffmpeg
  2. Clone Stratagus and build:
    git clone https://github.com/Wargus/stratagus.git
    cd stratagus/
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
  3. Clone Wargus and build:
    cd ../..
    git clone https://github.com/Wargus/wargus.git
    cd wargus
    mkdir build
    cd build
    cmake .. -DSTRATAGUS_INCLUDE_DIR=/home/alex/repos/stratagus/gameheaders/ -DSTRATAGUS=/usr/local/games/stratagus
    make
    sudo make install
  4. Run Wargus:
    /usr/local/games/wargus
  5. Click Ok. Select install.exe from BNE cd. Here I get my first error "You selected an exe file, but I cannot run innoextract to check if its a single-file installer. If it is, please extract/install manually first and then run wargus again." After that the extraction seems to continue okay.
    Not a supported Inno Setup installer!
    Done with 1 error.
    Running extractor as wartool -v -r '/run/media/alex/WAR2BNECD' '/home/alex/.stratagus/data.Wargus'
    Detected BNE CD
    Extract from "/run/media/alex/WAR2BNECD" to "/home/alex/.stratagus/data.Wargus"
    Please be patient, the data may take a couple of minutes to extract...
    Archive "/run/media/alex/WAR2BNECD/support/tomes/tome.2"
    Copied /run/media/alex/WAR2BNECD/support/tomes/tome.2->/home/alex/.stratagus/data.Wargus/support/tomes/tome.2
    Archive "/run/media/alex/WAR2BNECD/support/tomes/tome.4"
    Ignore entry 42 in archive (invalid uncompressed length)
    Copied /run/media/alex/WAR2BNECD/support/tomes/tome.4->/home/alex/.stratagus/data.Wargus/support/tomes/tome.4
    Archive "/run/media/alex/WAR2BNECD/support/tomes/tome.1"
    Ignore entry 25 in archive (invalid uncompressed length)
    Ignore entry 32 in archive (invalid uncompressed length)

    After that is a bunch of ffmpeg commands and output, and a bunch of lists of files being extracted.

  6. Extract from the additional DOS expansion CD? I select No.
  7. A popup appears saying "An error has occurred." In the terminal there is the end of a bunch of ffmpeg commands and
    
    video:0kB audio:1430kB subtitle:0kB other streams:0kB global headers:4kB muxing overhead: 1.254773%
    Done.
    Extracting from expansion subdir

(zenity:22972): Gtk-WARNING **: 10:41:26.689: Failed to set text 'Stratagus failed to load game data. If you just launched the game without any arguments, this may indicate a bug with the extraction process. Please report this on https://github.com/Wargus/stratagus/issues/new, and please give details, including: operating system, installation path, username, kind of source CD. If you got an error message about the extraction command failing, please try to run it in a console and post the output to the issue. A common problem is symbols in the path for the installation, the game data path, or the username (like an & or !). Try changing these. Try also to remove the folder /home/alex/.stratagus/data.Wargus and try the extraction again.' from markup due to error parsing markup: Error on line 1: Entity did not end with a semicolon; most likely you used an ampersand character without intending to start an entity — escape ampersand as &

8. The program then exits. Running it again reproduces the above error.  The cd path was

/run/media/alex/WAR2BNECD/

and there are no spaces or unusual characters in any path used.  The folder /home/alex/.stratagus/data.Wargus has a lot of files in it that all seem fine.

**Expected behavior**
I would expect to see some kind of game start screen.

**Screenshots and Logs**
$HOME/.stratagus/wc2/logs doesn't exist.

10:41:56 alex@Enki ~ → cd /home/alex/.stratagus/data.Wargus 10:45:57 alex@Enki data.Wargus → ls campaigns data_copied.wargus extracted graphics install.exe maps music scripts shaders sounds support videos 10:45:58 alex@Enki data.Wargus → ls ./*/ ./campaigns/: credits2.txt.gz credits.txt.gz human human-exp orc orc-exp

./graphics/: human missiles neutral orc tilesets ui

./maps/: 'All You Need BNE.pud.smp.gz' 'Crosshair BNE.pud.sms.gz' 'Frosty Fjords BNE.pud.sms.gz' king scenario 'The River Kwai BNE.pud.smp.gz' 'All You Need BNE.pud.sms.gz' 'Dark Paths BNE.pud.smp.gz' ftm ladder 'Schwartzwald BNE.pud.smp.gz' 'The River Kwai BNE.pud.sms.gz' 'Ant Trails BNE.pud.smp.gz' 'Dark Paths BNE.pud.sms.gz' 'Gold Rush BNE.pud.smp.gz' 'More Precious than Gold BNE.pud.smp.gz' 'Schwartzwald BNE.pud.sms.gz' 'Training Ground BNE.pud.smp.gz' 'Ant Trails BNE.pud.sms.gz' 'Dark Peninsula BNE.pud.smp.gz' 'Gold Rush BNE.pud.sms.gz' 'More Precious than Gold BNE.pud.sms.gz' skirmish 'Training Ground BNE.pud.sms.gz' 'Big Rock Candy Mountain BNE.pud.smp.gz' 'Dark Peninsula BNE.pud.sms.gz' 'Great White North BNE.pud.smp.gz' 'Mud in Your Eye BNE.pud.smp.gz' 'Skirmish BNE.pud.smp.gz' "Widow's End BNE.pud.smp.gz" 'Big Rock Candy Mountain BNE.pud.sms.gz' demo 'Great White North BNE.pud.sms.gz' 'Mud in Your Eye BNE.pud.sms.gz' 'Skirmish BNE.pud.sms.gz' "Widow's End BNE.pud.sms.gz" Classic fl 'Isolation BNE.pud.smp.gz' 'Murky River BNE.pud.smp.gz' 'Stir Crazy BNE.pud.smp.gz' 'Winding ways BNE.pud.smp.gz' 'Cramped BNE.pud.smp.gz' 'Forsaken Isles BNE.pud.smp.gz' 'Isolation BNE.pud.sms.gz' 'Murky River BNE.pud.sms.gz' 'Stir Crazy BNE.pud.sms.gz' 'Winding ways BNE.pud.sms.gz' 'Cramped BNE.pud.sms.gz' 'Forsaken Isles BNE.pud.sms.gz' 'Kaboom BNE.pud.smp.gz' 'Rose Petal BNE.pud.smp.gz' 'Taiga BNE.pud.smp.gz' 'World Domination BNE.pud.smp.gz' 'Crosshair BNE.pud.smp.gz' 'Frosty Fjords BNE.pud.smp.gz' 'Kaboom BNE.pud.sms.gz' 'Rose Petal BNE.pud.sms.gz' 'Taiga BNE.pud.sms.gz' 'World Domination BNE.pud.sms.gz'

./music/: 'Human Battle 1.mid' 'Human Battle 3.mid' 'Human Battle 5.mid' 'Human Briefing.ogg' 'Human Victory.ogg' 'Main Menu.wav' 'Orc Battle 2.ogg' 'Orc Battle 4.ogg' 'Orc Briefing.mid' 'Orc Victory.mid' 'Human Battle 1.ogg' 'Human Battle 3.ogg' 'Human Battle 5.ogg' 'Human Defeat.mid' "I'm a Medieval Man.mid" 'Orc Battle 1.mid' 'Orc Battle 3.mid' 'Orc Battle 5.mid' 'Orc Briefing.ogg' 'Orc Victory.ogg' 'Human Battle 2.mid' 'Human Battle 4.mid' 'Human Battle 6.ogg' 'Human Defeat.ogg' "I'm a Medieval Man.ogg" 'Orc Battle 1.ogg' 'Orc Battle 3.ogg' 'Orc Battle 5.ogg' 'Orc Defeat.mid' 'Human Battle 2.ogg' 'Human Battle 4.ogg' 'Human Briefing.mid' 'Human Victory.mid' 'Main Menu.mid' 'Orc Battle 2.mid' 'Orc Battle 4.mid' 'Orc Battle 6.ogg' 'Orc Defeat.ogg'

./scripts/: ai buttons.lua constructions.lua editor.lua guichan.lua lib missiles.lua scripts.lua spells.lua translate upgrade.lua widgets.lua ai.lua cheats.lua database.lua fonts.lua human lists multiplayer.lua singleplayer.lua stratagus.lua ui.lua wc2-config.lua anim.lua commands.lua directcontrol.lua fov.lua icons.lua menus orc sound.lua tilesets units.lua wc2.lua

./shaders/: aa-jinc2-sharp.cg.glsl bloom.cg.glsl crt-easymode.cg.glsl crt-reverse-aa.cg.glsl dotmask.cg.glsl tv-highcontrast-hd.cg.glsl xbr-lv2.cg.glsl

./sounds/: buildings human misc missiles neutral orc ships spells ui units

./support/: tomes

./videos/: exp-1.ogv gameintro.ogv human-1.ogv human-2.ogv human-3.ogv human-4.ogv human-exp-2.ogv logo.ogv orc-1.ogv orc-2.ogv orc-3.ogv orc-4.ogv orc-exp-2.ogv



**Desktop (please complete the following information):**
 - OS: Fedora 35
 - Version Stratagus v3.1.3-gitdbe38f171ba752f6a5cf471532d9a1628ffdefd4
timfel commented 2 years ago

Is there any other output in the terminal? Can you please run like so and report any log on the terminal?

/usr/local/game/stratagus -p -d /home/alex/.stratagus/data.Wargus
ghost commented 2 years ago
10:28:37 alex@Enki ~ → /usr/local/games/stratagus -p -d /home/alex/.stratagus/data.Wargus
GameCycle: 0d, init seed: 87654321
backtrace() returned 7 addresses
/usr/local/games/stratagus[0x54cab2]
/usr/local/games/stratagus[0x54ed82]
/usr/local/games/stratagus[0x54c662]
/usr/local/games/stratagus[0x52d8db]
/lib64/libc.so.6(+0x2d560)[0x7f12a5886560]
/lib64/libc.so.6(__libc_start_main+0x7c)[0x7f12a588660c]
/usr/local/games/stratagus[0x40bd55]
[0x0]
[0x0]
[0x0]
[0x653a443a643a6361]
[0x69683a4767463a45]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x5c5c5c5c5c5c5c5c]
[0x5c5c5c5c5c5c5c5c]
[0x0]
[0x0]
[0x0]
[0x0]
[0x26a00ff]
[0x7ffdb7276c80]
[0x2f2f2f2f2f2f2f2f]
[0x2f2f2f2f2f2f2f2f]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x653a443a643a6361]
[0x69683a4767463a45]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x22]
[0x1]
[0x0]
[0x21]
[0x20]
/lib64/libc.so.6(malloc+0x1a2)[0x7f12a58f67c2]
[0x30]
/lib64/libc.so.6(+0x202c80)[0x7f12a5a5bc80]
[0x2]
[0x8000000000000006]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x0]
[0x21]
[0x7ffdb7278f73]
[0x123062d99a146e00]
[0x7ffdb7277780]
[0x123062d99a146e00]
[0x0]
[0x7ffdb7277780]
[0x7ffdb7277978]
/usr/local/games/stratagus[0x52d8bb]
/lib64/ld-linux-x86-64.so.2(_rtld_global_ro+0x0)[0x7f12a602fc00]
/lib64/libc.so.6(_IO_fprintf+0x9a)[0x7f12a58b68ba]
[0x3000000020]
[0x7ffdb7277780]
[0x7ffdb72776c0]
[0x123062d99a146e00]
[0x0]
[0x0]
[0x0]
[0x87654321]
[0x1]
[0x0]
[0x7ffdb7277978]
[0x40000001e]
[0x7ffdb7277740]
[0x1a]
[0x7ffdb7277820]
/usr/local/games/stratagus[0x8c0920]
[0x9]
[0x7ffdb7278f54]
Segmentation fault (core dumped)
ghost commented 2 years ago

Running GDB gives:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f797dd in index2adr (idx=990998, L=0x976e70) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:71
Downloading 0.01 MB source file /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c
71            return (idx <= func->c.nupvalues)
(gdb) bt
#0  0x00007ffff7f797dd in index2adr (idx=990998, L=0x976e70) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:71
#1  index2adr (idx=-1001000, L=0x976e70) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:49
#2  lua_rawget (L=L@entry=0x976e70, idx=idx@entry=-1001000) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:560
#3  0x00007ffff7da5549 in tolua_open (L=0x976e70) at src/lib/tolua_map.c:297
#4  0x000000000063f539 in tolua_stratagus_open(lua_State*) ()
#5  0x000000000053d09f in InitLua() ()
#6  0x000000000054c688 in stratagusMain(int, char**) ()
#7  0x000000000052d8db in main ()
ghost commented 2 years ago

wargus_error This is what I am seeing after trying to run Wargus in the terminal.

ghost commented 2 years ago

I will try rebuilding with -DCMAKE_BUILD_TYPE=Debug and see if anything more obvious is visible.

timfel commented 2 years ago

Running GDB gives:

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7f797dd in index2adr (idx=990998, L=0x976e70) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:71
Downloading 0.01 MB source file /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c
71            return (idx <= func->c.nupvalues)
(gdb) bt
#0  0x00007ffff7f797dd in index2adr (idx=990998, L=0x976e70) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:71
#1  index2adr (idx=-1001000, L=0x976e70) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:49
#2  lua_rawget (L=L@entry=0x976e70, idx=idx@entry=-1001000) at /usr/src/debug/compat-lua-5.1.5-19.fc35.x86_64/src/lapi.c:560
#3  0x00007ffff7da5549 in tolua_open (L=0x976e70) at src/lib/tolua_map.c:297
#4  0x000000000063f539 in tolua_stratagus_open(lua_State*) ()
#5  0x000000000053d09f in InitLua() ()
#6  0x000000000054c688 in stratagusMain(int, char**) ()
#7  0x000000000052d8db in main ()

That looks like it crashes inside the lua library somewhere... odd

ghost commented 2 years ago

I tried looking for the tolua_stratagus_open function, but I can't really see where it is implemented.

cd stratagus/
/home/alex/repos/stratagus
11:10:32 alex@Enki stratagus ±|master ✗|→ grep -R tolua_stratagus_open .
./src/stratagus/script.cpp:extern int tolua_stratagus_open(lua_State *tolua_S);
./src/stratagus/script.cpp:     tolua_stratagus_open(Lua);
grep: ./build/stratagus: binary file matches

Running it in gdb after make cleaning and rerunning cmake with -DCMAKE_BUILD_TYPE=Debug and rebuilding didn't change any of the output.

ghost commented 2 years ago

Using the same data directory with the windows version of Stratagus running on wine works. So probably just an issue with the version of lua used on Fedora 35? Maybe lua is something that should be compiled as part of the build?

ghost commented 2 years ago

I am trying currently to get it to link to luajit, which should be lua 5.1 compatible, but am running into issues with tolua++ linking to lua 5.4. I will let you know if I can get another lua working.

timfel commented 2 years ago

Argh, yes, tolua++ definitely must link to Lua5.1, I had linker confusion there in the past. I'm not sure why it would fail on Fedora, when the Debian version of 5.1 works just fine, I can only imagine some platform patches.

ghost commented 2 years ago

I managed to build tolua from (https://github.com/LuaDist/toluapp) and link it against luajit, but now compilation is failing for stratagus:

[ 99%] Generating tolua.cpp

** tolua internal error: [string "tolua embedded: src/bin/lua/package.lua"]:325: attempt to call field 'gfind' (a nil value).

stack traceback:
        [string "tolua: embedded Lua code 23"]:6: in main chunk
[ 99%] Building CXX object CMakeFiles/stratagus.dir/tolua.cpp.o
cc1plus: fatal error: /home/alex/repos/stratagus/build/tolua.cpp: No such file or directory

So I might try this more next weekend and see if I can get the version of tolua++ from debian to build against luajit and try again.

timfel commented 2 years ago

you don't actually need toluapp to link against luajit. all it does is generate cpp bindings, and those are compatible between lua 5.1 and luajit.

ghost commented 2 years ago

I was building it from source since the version that ships in the fedora repos pulls in lua 5.4, and figured I may as well try using luajit since when running Wargus linked against the compat-lua-5.1 I was getting that segfault.

My thinking is that there is some combination of lua versions being used by different parts that is causing my issue since whatever versions are being used by debian/ubuntu seem to work. If compiling things against a single version works for me then I might be able to integrate the building of tolua++ and lua as part of the stratagus build, which would be ideal since then it would no longer depend on the versions shipped with the distribution. As part of that I figured luajit is at least an interesting change from the standard lua 5.1(is in a nonstandard location on my distribution, so requires lots of path changes). Plus messing around with stuff and seeing if any of it works is a decent way to get familiar with new code.

tolua++ and lua 5.1 are both fairly old at this point, at least the versions I am seeing, so it might make sense to vendor those in since they are very unlikely to change.

I am thinking one larger goal after I can get this working, would be trying to create an appimage version of the game(so it could run on any reasonable linux), which will work best if more of the dependencies are in one location(https://docs.appimage.org/packaging-guide/from-source/native-binaries.html#packaging-existing-binaries-or-manually-packaging-everything).

ghost commented 2 years ago

If you would like I can close this issue since it wasn't clear at the start it was about the system lua versions, and maybe reopen a more directed issue to keep things tidier. Especially since this seems to be a Stratagus issue, instead of Wargus.

ghost commented 2 years ago

I have opened this as an issue on Stratagus(https://github.com/Wargus/stratagus/issues/366), since this is no longer a wargus issue.