SIGSEGV on Linux when trying to run with -opengl
In version 1.2 opengl crashes on Linux. I did a stack trace on the coredump which I will list the output of here.
austin@VivoBook:~/Repositories/Kart-Public/bin/Linux64/Release$ coredumpctl gdb /home/austin/Repositories/Kart-Public/bin/Linux64/Release/lsdl2srb2kart.debug
PID: 17866 (lsdl2srb2kart.d)
UID: 1000 (austin)
GID: 1000 (austin)
Signal: 11 (SEGV)
Timestamp: Tue 2020-05-12 15:35:04 CDT (15min ago)
Command Line: ./lsdl2srb2kart.debug -opengl
Executable: /home/austin/Repositories/Kart-Public/bin/Linux64/Release/lsdl2srb2kart.debug
Control Group: /user.slice/user-1000.slice/session-2.scope
Unit: session-2.scope
Slice: user-1000.slice
Session: 2
Owner UID: 1000 (austin)
Boot ID: b1024077b03049cbb22a6754007f381f
Machine ID: 184ec2527aff4d048a75dc300e6c1838
Hostname: VivoBook
Storage: /var/lib/systemd/coredump/core.lsdl2srb2kart\x2ed.1000.b1024077b03049cbb22a6754007f381f.17866.1589315704000000000000.lz4
Message: Process 17866 (lsdl2srb2kart.d) of user 1000 dumped core.
Stack trace of thread 17866:
#0 0x00007f1bc8a66075 _IO_fwrite (libc.so.6 + 0x76075)
#1 0x00005612dc97c322 n/a (/home/austin/Repositories/Kart-Public/bin/Linux64/Release/lsdl2srb2kart.debug + 0x18b322)
#2 0x706d6f432820362e n/a (n/a + 0x0)
GNU gdb (GDB) 9.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/austin/Repositories/Kart-Public/bin/Linux64/Release/lsdl2srb2kart.debug...
[New LWP 17866]
[New LWP 17870]
[New LWP 17869]
[New LWP 17871]
[New LWP 17872]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `./lsdl2srb2kart.debug -opengl'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007f1bc8a66075 in fwrite () from /usr/lib/libc.so.6
[Current thread is 1 (Thread 0x7f1bc80b7cc0 (LWP 17866))]
(gdb) bt
#0 0x00007f1bc8a66075 in fwrite () from /usr/lib/libc.so.6
#1 0x00005612dc97c322 in GL_DBG_Printf (format=format@entry=0x5612dca8e548 "OpenGL %s\n") at hardware/r_opengl/r_opengl.c:162
#2 0x00005612dc982cae in OglSdlSurface (w=320, h=200) at sdl/ogl_sdl.c:166
#3 0x00005612dc979fb9 in SDLSetMode (fullscreen=<optimized out>, height=<optimized out>, width=<optimized out>) at sdl/i_video.c:225
#4 VID_SetMode (modeNum=<optimized out>) at sdl/i_video.c:1647
#5 0x00005612dc97a6b9 in I_StartupGraphics () at sdl/i_video.c:1510
#6 0x00005612dc838ffd in D_SRB2Main () at d_main.c:1307
#7 0x00005612dc83753d in main (argc=<optimized out>, argv=<optimized out>) at sdl/i_main.c:166
(gdb) up
#1 0x00005612dc97c322 in GL_DBG_Printf (format=format@entry=0x5612dca8e548 "OpenGL %s\n") at hardware/r_opengl/r_opengl.c:162
162 fwrite(str, strlen(str), 1, gllogstream);
(gdb) l
157
158 va_start(arglist, format);
159 vsnprintf(str, 4096, format, arglist);
160 va_end(arglist);
161
162 fwrite(str, strlen(str), 1, gllogstream);
163 #else
164 (void)format;
165 #endif
166 }
(gdb) p gllogstream
$1 = (FILE *) 0x0
I changed line 151 of hardware/r_opengl/r_opengl.c from #ifdef DEBUG_TO_FILE
to #if 0
which obviously isn't a proper solution but as a quick and dirty workaround for debugging it got the game up and running with opengl
The new models look fantastic btw!