nukeykt / NBlood

Reverse-engineered ports of Build games using EDuke32 engine technology and development principles (NBlood/Rednukem/PCExhumed)
612 stars 78 forks source link

Segmentation fault (core dumped) with the last version (on Ubuntu 24.04) #833

Closed veptune closed 2 months ago

veptune commented 3 months ago

Hello all,

From the last available version (r14080-57835db65) .

Installed via git pull on my Ubuntu

I start the game with ./nbood, I got the config popup, but after clicking on the Start button I got a segmentation fault.

nicolas@localhost:~/Desktop/jeux/NBlood$ ./nblood 
mimalloc: warning: unable to allocate huge (1GiB) page, trying large (2MiB) pages instead (errno: 12)
 runtime  src| 
 0.1142s INFO| Started at 2024-08-06 22:02:41.225
 0.1143s INFO| NBlood r14080-57835db65
 0.1143s INFO| Built Aug  6 2024 14:15:55, GCC 13.2.0, 64-bit
 0.1143s INFO| Using directory /home/nicolas/Desktop/jeux/NBlood/
 0.1144s INFO| Using directory /home/nicolas/.config/nblood/
 0.1167s INFO| CPU: 13th Gen Intel(R) Core(TM) i5-13500H
 0.1167s INFO| Initializing SDL 2.30.0 (SDL-release-2.30.0-0-g859844eae (Ubuntu 2.30.0+dfsg-1build3))
ATTENTION: default value of option mesa_glthread overridden by environment.
 0.2664s INFO| Using 'x11' video driver.
123.6296s INFO| Using "nblood.pk3" as main game data file.
123.6301s INFO| Initializing OSD...
123.6340s INFO| Initializing Build 3D engine
123.6340s INFO| Initializing engine
123.6351s INFO| Loading palettes
123.6353s INFO| Loading translucency table
123.6364s INFO| Loading gamma correction table
123.6365s INFO| Creating standard color lookups
123.6365s INFO| Loading tiles
123.6399s INFO| Initialized 96.0M cache
123.6487s INFO| Loading blood_widescreen.def
123.6550s INFO| Loading blood.def
123.6587s INFO| Definitions file "blood.def" loaded in 4 ms.
123.6587s INFO| Loading cosine table
123.6587s INFO| Initializing view subsystem
123.6587s INFO| Initializing status bar
123.6588s INFO| Initializing dynamic fire

Caught signal: SIGSEGV
Segmentation fault (core dumped)

Any clue?

Thanks

CommonLoon102 commented 3 months ago

Compile a debug build, see if it still happens. Use gdb to debug.

Hendricks266 commented 3 months ago

https://wiki.eduke32.com/wiki/Troubleshooting_EDuke32

veptune commented 3 months ago

Here is what I got when running with gdb but I don't think it will help you :

212.5008s INFO| Using "nblood.pk3" as main game data file.
212.5011s INFO| Initializing OSD...
212.5053s INFO| Initializing Build 3D engine
212.5053s INFO| Initializing engine
212.5064s INFO| Loading palettes
212.5066s INFO| Loading translucency table
212.5077s INFO| Loading gamma correction table
212.5077s INFO| Creating standard color lookups
212.5078s INFO| Loading tiles
212.5103s INFO| Initialized 96.0M cache
212.5186s INFO| Loading blood_widescreen.def
212.5247s INFO| Loading blood.def
212.5284s INFO| Definitions file "blood.def" loaded in 4 ms.
212.5285s INFO| Loading cosine table
212.5285s INFO| Initializing view subsystem
212.5285s INFO| Initializing status bar
212.5285s INFO| Initializing dynamic fire

Thread 1 "nblood" received signal SIGSEGV, Segmentation fault.
0x00005555555d85e6 in ?? ()
(gdb) 
(gdb) 
(gdb) bt
#0  0x00005555555d85e6 in ??? ()
#1  0x000055555558985d in ??? ()
#2  0x000055555557e4d9 in main ()
(gdb) 
Hendricks266 commented 3 months ago

You need to make clean && make RELEASE=0.

veptune commented 3 months ago

So after doing t this : make clean && make RELEASE=0.

I start ./nblood again and I got :

0.1072s INFO| Started at 2024-08-06 22:52:10.865
 0.1073s INFO| NBlood r14080-57835db65
 0.1073s INFO| Built Aug  6 2024 22:51:25, GCC 13.2.0, 64-bit
 0.1073s INFO| Using directory /home/nicolas/Desktop/jeux/NBlood/
 0.1074s INFO| Using directory /home/nicolas/.config/nblood/
 0.1085s INFO| CPU: 13th Gen Intel(R) Core(TM) i5-13500H
 0.1085s INFO| Initializing SDL 2.30.0 (SDL-release-2.30.0-0-g859844eae (Ubuntu 2.30.0+dfsg-1build3))
ATTENTION: default value of option mesa_glthread overridden by environment.
 0.2558s INFO| Using 'x11' video driver.
 6.2098s INFO| Using "nblood.pk3" as main game data file.
 6.2102s INFO| Initializing OSD...
 6.2156s INFO| Initializing Build 3D engine
 6.2157s INFO| Initializing engine
 6.2169s INFO| Loading palettes
 6.2172s INFO| Loading translucency table
 6.2184s INFO| Loading gamma correction table
 6.2184s INFO| Creating standard color lookups
 6.2185s INFO| Loading tiles
 6.2231s INFO| Initialized 96.0M cache
 6.2306s INFO| Loading blood_widescreen.def
 6.2312s WARN| tilefromtexture: CRC32 of tile 2200 doesn't match! CRC32: 0x00000000, Expected: 0xDCEB91B3
 6.2313s WARN| tilefromtexture: CRC32 of tile 2574 doesn't match! CRC32: 0x00000000, Expected: 0xDA2186B1
 6.2376s INFO| Loading blood.def
 6.2377s WARN| tilefromtexture: CRC32 of tile 2200 doesn't match! CRC32: 0x00000000, Expected: 0xDCEB91B3
 6.2378s WARN| tilefromtexture: CRC32 of tile 2574 doesn't match! CRC32: 0x00000000, Expected: 0xDA2186B1
 6.2433s INFO| Definitions file "blood.def" loaded in 5 ms.
 6.2434s INFO| Loading cosine table
 6.2434s INFO| Initializing view subsystem
 6.2434s INFO| Initializing status bar
 6.2434s INFO| Initializing dynamic fire

Caught signal: SIGSEGV
Segmentation fault (core dumped)
Hendricks266 commented 3 months ago

Run the debug build under GDB and get the backtrace.

veptune commented 3 months ago

OK make FORCEDEBUG=1

veptune commented 3 months ago

when making the debug build I got many errors like this one :

/usr/bin/ld: cannot find obj/mimalloc/prim/prim.o.debug.temp.o: No such file or directory /usr/bin/ld: cannot find obj/glad/glad.o.debug.temp.o: No such file or directory collect2: error: ld returned 1 exit status Failed linking nblood! If the build options, environment, or system packages have changed, run 'make clean' and try again.

I ran make clean before each time I run make so I don't understand why I got those errors :(

CommonLoon102 commented 3 months ago

I've just compiled it on a fully updated Ubuntu 24.04. Movie files play, sound works, MIDI (OPL3) plays, official demo files play. OpenGL works, fullscreen works. Maybe a driver issue? I'm using nvidia-driver-535-server. Game runs well.

worksforme

veptune commented 3 months ago

I don't think it is driver issue because I can run eduke32 and openarena.

Where can I find the binnaries for windows ?

CommonLoon102 commented 3 months ago

Where can I find the binnaries for windows ?

https://github.com/nukeykt/NBlood/releases

Hendricks266 commented 3 months ago

OK make FORCEDEBUG=1

No!! The debug build is what you made by running make clean && make RELEASE=0. Just run that with GDB!

Hendricks266 commented 3 months ago

@veptune Any luck getting a backtrace?

veptune commented 3 months ago

Hello,

So I have compiled with RELEASE=0 and here is the gdb backtrace :

 2.2575s INFO| Started at 2024-08-09 23:17:48.823
 2.2575s INFO| NBlood r14080-57835db65
 2.2575s INFO| Built Aug  9 2024 21:25:30, GCC 13.2.0, 64-bit
 2.2576s INFO| Using directory /home/nicolas/Desktop/jeux/NBlood/
 2.2576s INFO| Using directory /home/nicolas/.config/nblood/
 2.2585s INFO| CPU: 13th Gen Intel(R) Core(TM) i5-13500H
 2.2586s INFO| Initializing SDL 2.30.0 (SDL-release-2.30.0-0-g859844eae (Ubuntu 2.30.0+dfsg-1build3))
[New Thread 0x7fffe98006c0 (LWP 43623)]
[Thread 0x7fffeea006c0 (LWP 43617) exited]
[New Thread 0x7fffeea006c0 (LWP 43626)]
[New Thread 0x7fffe8c006c0 (LWP 43627)]
[New Thread 0x7fffe1c006c0 (LWP 43628)]
[New Thread 0x7fffe12006c0 (LWP 43629)]
ATTENTION: default value of option mesa_glthread overridden by environment.
[New Thread 0x7fffd7e006c0 (LWP 43630)]
[Thread 0x7fffd7e006c0 (LWP 43630) exited]
[Thread 0x7fffe12006c0 (LWP 43629) exited]
[Thread 0x7fffe1c006c0 (LWP 43628) exited]
 4.0748s INFO| Using 'x11' video driver.
[New Thread 0x7fffe1c006c0 (LWP 43631)]
[Thread 0x7fffed6006c0 (LWP 43619) exited]
20.0776s INFO| Using "nblood.pk3" as main game data file.

Thread 1 "nblood" received signal SIGSEGV, Segmentation fault.
Download failed: Invalid argument.  Continuing without source file ./string/../sysdeps/x86_64/multiarch/strcmp-avx2.S.
__strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283
warning: 283    ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or directory
Hendricks266 commented 3 months ago

@veptune Please run the bt command in GDB when the crash occurs to get the backtrace. The log you posted does not contain a backtrace.

veptune commented 3 months ago

Sorry, here is the bt :+1:

Thread 1 "nblood" received signal SIGSEGV, Segmentation fault.
Download failed: Invalid argument.  Continuing without source file ./string/../sysdeps/x86_64/multiarch/strcmp-avx2.S.
__strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283
warning: 283    ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or directory
(gdb) bt
#0  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283
#1  0x0000555555623e02 in app_main (argc=<optimized out>, argv=<optimized out>) at source/blood/src/blood.cpp:1697
#2  0x00005555557e02a4 in main (argc=<optimized out>, argv=<optimized out>) at source/build/src/sdlayer.cpp:568
CommonLoon102 commented 3 months ago

So it crashes at this line because of strcmp:

https://github.com/nukeykt/NBlood/blob/57835db651aad9864f20c0944a7538e645e766c8/source/blood/src/blood.cpp#L1697C13-L1697C19

But why. Try changing it to Bstrcmp and recompile it.

veptune commented 2 months ago

OK I did it (i did not forgot to do the make clean) But I still have segmentation fault. Here is the backtrace.

2.2330s INFO| Using 'x11' video driver. [New Thread 0x7fffddc006c0 (LWP 25243)] 6.9537s INFO| Using "nblood.pk3" as main game data file.

Thread 1 "nblood" received signal SIGSEGV, Segmentation fault.
Download failed: Invalid argument.  Continuing without source file ./string/../sysdeps/x86_64/multiarch/strcmp-avx2.S.
__strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283
warning: 283    ../sysdeps/x86_64/multiarch/strcmp-avx2.S: No such file or directory
(gdb) bt
#0  __strcmp_avx2 () at ../sysdeps/x86_64/multiarch/strcmp-avx2.S:283
#1  0x0000555555623e02 in app_main (argc=<optimized out>, argv=<optimized out>) at source/blood/src/blood.cpp:1697
#2  0x00005555557e02a4 in main (argc=<optimized out>, argv=<optimized out>) at source/build/src/sdlayer.cpp:568
Hendricks266 commented 2 months ago

I believe 8ea10db417db83819a1596222d4f14aab3d4bdd6 fixes this, could you confirm?

veptune commented 2 months ago

I updated the code but now I have a new error :

1.9983s ERROR| source/blood/src/resource.cpp(97): File not found BLOOD.RFF

Does this file is from the original game? because I have already copied the original blood files in the NBblood folder, so all files should be there.

veptune commented 2 months ago

That is wierd, all the Blood 1.21 I find does not have the blood.rff file... let me fix this first and I'll come back you. Sorry .

Hendricks266 commented 2 months ago

Glad the crash is fixed. All installations of Blood contain BLOOD.RFF, including the versions available on GOG and Steam.