phoboslab / wipeout-rewrite

2.59k stars 198 forks source link

Linux SDL build startup crash unless DEBUG set #97

Open wgmyers opened 9 months ago

wgmyers commented 9 months ago

When I compile with make sdl the game opens a window and crashes immediately without error message.

If I use DEBUG=true make sdl it works fine.

This is with gcc 7.5.0 on Ubuntu 18.04.

phoboslab commented 9 months ago

Sound like there's some discrepancies with already compiled files. Try make clean first.

Not sure if/how this could be handled in the makefile.

wgmyers commented 9 months ago

Was always doing a make clean first, but scanning back through output there may be a clue to what is happening. Advance apologies for long post.

First off: I get a couple warnings compiling without DEBUG set that don't happen if it is set.

Specifically:

cc -Isrc/libs/ -std=gnu99 -Wall -Wno-unused-variable  -O3 -DRENDERER_GL -MMD -MP -c src/wipeout/sfx.c -o build/obj/native/src/wipeout/sfx.o
In file included from src/wipeout/sfx.c:10:0:
src/libs/qoa.h: In function ‘qoa_encode_frame’:
src/libs/qoa.h:455:24: warning: ‘best_scalefactor’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    prev_scalefactor[c] = best_scalefactor;
    ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/libs/qoa.h:466:15: warning: ‘best_slice’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    best_slice <<= (QOA_SLICE_LEN - slice_len) * 3;
    ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This warning does not occur when compiling with DEBUG.

Also, "crashes without error message" was not accurate, my apologies.

Without DEBUG set, there is some output, and the crash occurs just after the first music track is loaded:

$ ./wipegame 
load gamecontrollerdb.txt
atlas texture     1
inserted atlas texture (  2x  2) at (  0,  0)
load save data success
load cmp wipeout/textures/drfonts.cmp
inserted atlas texture (212x 64) at (  2,  0)
inserted atlas texture (208x 36) at ( 10,  0)
inserted atlas texture (216x 16) at ( 18,  0)
inserted atlas texture ( 24x 16) at ( 26,  0)
inserted atlas texture (  8x  8) at ( 28,  0)
inserted atlas texture ( 20x 16) at ( 30,  0)
inserted atlas texture ( 20x 16) at ( 32,  0)
inserted atlas texture ( 24x 16) at ( 34,  0)
inserted atlas texture ( 24x 16) at ( 36,  0)
inserted atlas texture ( 12x 12) at ( 38,  0)
load: wipeout/textures/speedo.tim
inserted atlas texture (128x 32) at ( 40,  0)
load: wipeout/textures/target2.tim
inserted atlas texture ( 16x 16) at ( 45,  0)
load cmp wipeout/common/wicons.cmp
inserted atlas texture ( 32x 32) at ( 47,  0)
inserted atlas texture ( 32x 32) at ( 49,  0)
inserted atlas texture ( 32x 32) at ( 51,  0)
inserted atlas texture ( 32x 32) at ( 53,  0)
inserted atlas texture ( 32x 32) at ( 55,  0)
inserted atlas texture ( 32x 32) at ( 57,  0)
inserted atlas texture ( 32x 32) at ( 59,  0)
inserted atlas texture ( 32x 32) at ( 61,  0)
inserted atlas texture ( 32x 32) at (  0,  2)
load cmp wipeout/common/allsh.cmp
inserted atlas texture ( 96x 64) at ( 18,  2)
inserted atlas texture ( 96x 64) at ( 22,  2)
inserted atlas texture ( 96x 64) at ( 26,  2)
inserted atlas texture ( 64x 64) at ( 30,  2)
inserted atlas texture ( 48x 48) at ( 33,  2)
inserted atlas texture ( 96x 64) at ( 36,  2)
inserted atlas texture ( 96x 64) at ( 40,  2)
inserted atlas texture ( 72x 64) at ( 44,  2)
inserted atlas texture ( 32x 64) at ( 48,  2)
inserted atlas texture ( 64x 64) at ( 50,  2)
inserted atlas texture ( 48x 48) at ( 53,  2)
inserted atlas texture ( 48x 48) at ( 56,  2)
inserted atlas texture ( 96x 64) at ( 59,  2)
inserted atlas texture ( 96x 64) at (  2,  3)
inserted atlas texture ( 64x 64) at (  6,  3)
inserted atlas texture ( 96x 64) at (  9,  3)
inserted atlas texture ( 72x 64) at ( 13,  3)
inserted atlas texture ( 48x 48) at ( 17,  5)
inserted atlas texture ( 64x 64) at ( 20,  5)
inserted atlas texture ( 48x 48) at ( 23,  5)
inserted atlas texture ( 96x 64) at ( 26,  5)
inserted atlas texture ( 96x 64) at ( 30,  5)
inserted atlas texture ( 96x 64) at ( 34,  5)
inserted atlas texture ( 72x 64) at ( 38,  5)
inserted atlas texture ( 96x 64) at ( 42,  5)
inserted atlas texture ( 96x 64) at ( 46,  5)
inserted atlas texture ( 96x 64) at ( 50,  5)
inserted atlas texture ( 72x 64) at ( 54,  5)
inserted atlas texture ( 64x 64) at ( 58,  5)
inserted atlas texture ( 48x 48) at (  0,  6)
inserted atlas texture ( 96x 64) at (  3,  6)
inserted atlas texture ( 64x 64) at (  7,  6)
inserted atlas texture ( 96x 64) at ( 10,  6)
inserted atlas texture ( 72x 64) at ( 14,  8)
inserted atlas texture ( 48x 48) at ( 18,  8)
inserted atlas texture ( 96x 64) at ( 21,  8)
inserted atlas texture ( 64x 64) at ( 25,  8)
inserted atlas texture ( 96x 64) at ( 28,  8)
inserted atlas texture ( 96x 64) at ( 32,  8)
inserted atlas texture ( 48x 48) at ( 36,  8)
inserted atlas texture ( 72x 64) at ( 39,  8)
inserted atlas texture ( 96x 64) at ( 43,  8)
inserted atlas texture ( 64x 64) at ( 47,  8)
inserted atlas texture ( 96x 64) at ( 50,  8)
inserted atlas texture ( 96x 64) at ( 54,  8)
inserted atlas texture ( 48x 48) at ( 58,  8)
inserted atlas texture ( 72x 64) at (  0,  9)
inserted atlas texture ( 96x 64) at (  4,  9)
inserted atlas texture ( 96x 64) at (  8,  9)
inserted atlas texture ( 72x 64) at ( 12, 11)
inserted atlas texture ( 48x 48) at ( 16, 11)
load: wipeout/common/allsh.prm
load cmp wipeout/common/alcol.cmp
inserted atlas texture ( 96x 64) at ( 19, 11)
inserted atlas texture ( 96x 64) at ( 23, 11)
inserted atlas texture ( 96x 64) at ( 27, 11)
inserted atlas texture ( 96x 64) at ( 31, 11)
inserted atlas texture ( 96x 64) at ( 35, 11)
inserted atlas texture ( 96x 64) at ( 39, 11)
inserted atlas texture ( 96x 64) at ( 43, 11)
load: wipeout/common/alcol.prm
load: wipeout/textures/shad1.tim
inserted atlas texture (128x256) at ( 47, 11)
load: wipeout/textures/shad2.tim
inserted atlas texture (128x256) at ( 52, 11)
load: wipeout/textures/shad3.tim
inserted atlas texture (128x256) at ( 57, 11)
load: wipeout/textures/shad4.tim
inserted atlas texture (128x256) at (  0, 12)
load cmp wipeout/common/rescu.cmp
inserted atlas texture ( 64x 64) at (  5, 12)
inserted atlas texture ( 48x144) at (  8, 12)
inserted atlas texture ( 64x 64) at ( 11, 14)
inserted atlas texture ( 64x 64) at ( 14, 14)
inserted atlas texture ( 96x 96) at ( 17, 14)
inserted atlas texture ( 64x 64) at ( 21, 14)
inserted atlas texture ( 96x 48) at ( 24, 14)
load: wipeout/common/rescu.prm
load cmp wipeout/common/effects.cmp
inserted atlas texture ( 32x 32) at ( 28, 14)
inserted atlas texture ( 32x 32) at ( 30, 14)
inserted atlas texture ( 32x 32) at ( 32, 14)
inserted atlas texture ( 32x 32) at ( 34, 14)
inserted atlas texture ( 32x 32) at ( 36, 14)
inserted atlas texture ( 32x 32) at ( 38, 14)
load: wipeout/textures/target2.tim
inserted atlas texture ( 16x 16) at ( 40, 14)
load cmp wipeout/common/mine.cmp
inserted atlas texture ( 64x 64) at ( 42, 14)
inserted atlas texture ( 32x 32) at ( 45, 14)
load: wipeout/common/rock.prm
load: wipeout/common/mine.prm
load: wipeout/common/miss.prm
load: wipeout/common/shld.prm
load: wipeout/common/shld.prm
load: wipeout/common/ebolt.prm
open music track 3
inserted atlas texture (320x192) at ( 28, 16)
[1]    3510 segmentation fault (core dumped)  ./wipegame

FWIW, I tried setting best_slice and best_scalefactor to 0 explicitly in qoa.h - didnt get the warning, but still got the crash. I have no idea if 0 is a sensible thing to set them to as I have no idea what is going on in the code there.

phoboslab commented 9 months ago

The warning in qoa.h is a false positive. best_scalefactor and best_slice is always set because current_error in the first iteration is always less than the first best_error (INFINITY). Also, this part of the library (the encoder) is not used in the game anyway. But yeah, we should silence this...

So the crash seems to happen in the intro video scene, right after the 320x192 framebuffer for the video is allocated in the texture atlas. As a simple test, you can try to rename/delete/move wipeout/intro.mpeg. If the game can't find the file, the intro will be skipped.

Otherwise, please run wipegame with a debugger and see where the crash is happening: gdb -ex run wipegame

wgmyers commented 8 months ago

Apologies for slow reply.

Renaming wipeout/intro.mpeg works. The game runs fine if that is done.

I tried gdb -ex run wipgame also, with the intro video named back to intro.mpeg. Not hugely familiar with gdb, but the last lines of output were:

Thread 1 "wipegame" received signal SIGSEGV, Segmentation fault.
0x000055555557a2fb in plm_video_idct ()
felisucoibi commented 7 months ago

I compiled the game with ubuntu 23.04 and no problems at all. make gdl and is ready to launch. Btw ubuntu 18.04 still has suport? is from 2018... imagen