protrekkr
protrekkr copied to clipboard
Crash on Fedora 36
I am compiling protrekkr with gcc 12 on Fedora 36. When I start protrekkr, I've got a segmentation fault after startup:
SDL_SetPalette (ncolors=256, firstcolor=0, colors=0x79d080 <Ptk_Palette>, flags=2, surface12=0x20f5eb0) at /usr/src/debug/sdl12-compat-0.0.1~git.20211125.4e4527a-4.fc36.x86_64/src/SDL12_compat.c:6091
6091 palette12 = surface12->format->palette;
(gdb) where
#0 SDL_SetPalette (ncolors=256, firstcolor=0, colors=0x79d080 <Ptk_Palette>, flags=2, surface12=0x20f5eb0)
at /usr/src/debug/sdl12-compat-0.0.1~git.20211125.4e4527a-4.fc36.x86_64/src/SDL12_compat.c:6091
#1 SDL_SetPalette (surface12=0x20f5eb0, flags=2, colors=0x79d080 <Ptk_Palette>, firstcolor=0, ncolors=256)
at /usr/src/debug/sdl12-compat-0.0.1~git.20211125.4e4527a-4.fc36.x86_64/src/SDL12_compat.c:6075
#2 0x0000000000473b4a in UISetPalette(SDL_Color*, int) [clone .constprop.0] (Amount=256, Palette=<optimized out>)
at src/ui/draw_primitives.cpp:122
#3 0x0000000000460b24 in Refresh_Palette () at src/ui/misc_draw.cpp:3049
#4 Kill_Requester () at src/ui/requesters.cpp:398
#5 Check_Requester (Requester=<optimized out>) at src/ui/requesters.cpp:304
#6 0x0000000000411cb6 in Screen_Update () at src/ptk.cpp:1882
#7 0x000000000040717b in main (argc=<optimized out>, argv=<optimized out>) at src/support/main.cpp:876
I was able to grab some informations:
(gdb) list
6086
6087 if ((flags & (SDL12_LOGPAL | SDL12_PHYSPAL)) == 0) {
6088 return 0; /* nothing to do. */
6089 ``` }
6090
6091 palette12 = surface12->format->palette;
6092 if (!palette12) {
6093 return 0; /* not an error, a no-op. */
6094 }
6095
(gdb) print surface12
&$1 = (SDL12_Surface *) 0x20f5eb0
(gdb) print surface12->format
$2 = (SDL12_PixelFormat *) 0x0
I just recompiled with the latest repository (the one from 8 minutes ago) on Debian 64 (in VirtualBox) and it works (albeit there may be some framerate issues with ALSA).
Still segfautling on Fedora 38:
Thread 1 "ptk_linux" received signal SIGSEGV, Segmentation fault.
0x00007ffff7e5c26b in SDL_SetPalette (surface12=0x2478bf0, flags=2, colors=0x7aaf80 <Ptk_Palette>, firstcolor=0, ncolors=256)
at /usr/src/debug/sdl12-compat-1.2.68-1.fc38.x86_64/src/SDL12_compat.c:7430
7430 palette20 = surface12->surface20->format->palette;
(gdb) where
#0 0x00007ffff7e5c26b in SDL_SetPalette (surface12=0x2478bf0, flags=2, colors=0x7aaf80 <Ptk_Palette>, firstcolor=0, ncolors=256)
at /usr/src/debug/sdl12-compat-1.2.68-1.fc38.x86_64/src/SDL12_compat.c:7430
#1 0x0000000000499a89 in UISetPalette (Palette=0x7aaf80 <Ptk_Palette>, Amount=256) at src/ui/draw_primitives.cpp:110
#2 0x000000000049986f in Refresh_Palette () at src/ui/misc_draw.cpp:3041
#3 0x000000000049baba in Kill_Requester () at src/ui/requesters.cpp:398
#4 0x000000000049bd65 in Check_Requester (Requester=<optimized out>) at src/ui/requesters.cpp:304
#5 0x00000000004168b2 in Screen_Update () at src/ptk.cpp:1891
#6 0x0000000000405560 in main (argc=<optimized out>, argv=0x7fffffffd578) at src/support/main.cpp:915
Can you try with the following flags ?
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
And I think, these ones are the ones triggering the problems:
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS
Try it again, it should work now...
Thanks a lot, it works fine now ! I close the ticket !