Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 830724 - games-emulation/dosbox-staging crash in less than 1 ms after startup
Summary: games-emulation/dosbox-staging crash in less than 1 ms after startup
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Bernard Cafarelli
Depends on:
Reported: 2022-01-07 09:10 UTC by Francois Chenier
Modified: 2022-01-13 12:00 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---

emerge --info (,5.37 KB, text/plain)
2022-01-07 09:10 UTC, Francois Chenier

Note You need to log in before you can comment on or make changes to this bug.
Description Francois Chenier 2022-01-07 09:10:24 UTC
Created attachment 761469 [details]
emerge --info

It is kind a little bit sad but dosbox-staging (all versions presently in the tree) crash straight away after 1 ms

belgix@darwin ~ $ dosbox
date       time         | 
2022-01-07 18:39:56.863 | arguments: dosbox
2022-01-07 18:39:56.863 | Current dir: /home/belgix
2022-01-07 18:39:56.863 | stderr verbosity: 0
2022-01-07 18:39:56.863 | -----------------------------------
2022-01-07 18:39:56.864 | dosbox-staging version 0.78.0
2022-01-07 18:39:56.864 | ---

Loguru caught a signal: SIGSEGV
Stack trace:
0       0x7fec865479d0 /lib64/ [0x7fec865479d0]
2022-01-07 18:39:57.010 | Signal: SIGSEGV
Segmentation fault

The thing that will make debugging harder, dosbox doesn't crash and run normally if I run the process in the debugger using that command 

gdb -ex='set confirm on' -ex=run -ex=quit dosbox

AFAIK, the crash is not related to my dosbox-staging.conf file. The same problem happens with the default config file.
Comment 1 Francois Chenier 2022-01-07 09:15:02 UTC
Further comment. Dosbox crash when creating a thread, before reading the config file.

GNU gdb (Gentoo 11.1 vanilla) 11.1
Copyright (C) 2021 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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:
Find the GDB manual and other documentation resources online at:

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from dosbox...
(No debugging symbols found in dosbox)
Starting program: /usr/bin/dosbox 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/".
date       time         | 
2022-01-07 19:12:05.448 | arguments: /usr/bin/dosbox
2022-01-07 19:12:05.448 | Current dir: /home/belgix
2022-01-07 19:12:05.448 | stderr verbosity: 0
2022-01-07 19:12:05.448 | -----------------------------------
2022-01-07 19:12:05.449 | dosbox-staging version 0.78.0
2022-01-07 19:12:05.449 | ---
[New Thread 0x7fffe42a3640 (LWP 3706)]
2022-01-07 19:12:05.725 | CONFIG: Loaded primary conf file /home/belgix/.config/dosbox/dosbox-staging.conf
2022-01-07 19:12:05.725 | DISPLAY: Initialized 840x630 window-mode using Bilinear scaling on 900p display-0
2022-01-07 19:12:05.747 | DISPLAY: Unknown 640x400 (mode FFFFh) scaling by 1.3x1.6 to 840x630 with 1.20 pixel-aspect
2022-01-07 19:12:05.849 | SDL: Using driver "software" for texture renderer
2022-01-07 19:12:06.874 | SDL: Mouse will move seamlessly without being captured and middle-click will uncapture the mouse.
2022-01-07 19:12:06.874 | LANG: Using internal English language messages
2022-01-07 19:12:06.910 | MEMORY: Base address: 0x7fffde7ff010
2022-01-07 19:12:06.910 | MEMORY: Using 4096 DOS memory pages (16 MiB)
2022-01-07 19:12:06.913 | VIDEO: Initialized S3 Trio64 VESA 2.0 compatible with 4-MiB of FP DRAM supporting 86 modes
[New Thread 0x7fffcdbfb640 (LWP 3741)]
2022-01-07 19:12:06.924 | MIXER: SDL changed the blocksize from 512 to 256 frames
2022-01-07 19:12:06.924 | MIXER: Negotiated 2-channel 48000-Hz audio in 256-frame blocks
2022-01-07 19:12:06.924 | MIDI: No working MIDI device found/selected.
2022-01-07 19:12:06.924 | MIDI: Opened device: none
2022-01-07 19:12:06.924 | MIXER: FM channel operating at 48000 Hz without resampling
2022-01-07 19:12:06.924 | MIXER: SB channel operating at 22050 Hz and upsampling to the output rate
2022-01-07 19:12:06.924 | SB16: @SET BLASTER=A220 I7 D1 H5 T6
2022-01-07 19:12:06.924 | MIXER: SPKR channel operating at 18939 Hz and upsampling to the output rate
2022-01-07 19:12:06.924 | MIXER: DISNEY channel operating at 10000 Hz and upsampling to the output rate
2022-01-07 19:12:06.926 | AUTOEXEC: Using autoexec from one or more joined sections
2022-01-07 19:12:06.926 | MAPPER: joystick subsystem disabled
2022-01-07 19:12:06.927 | MAPPER: Loaded default key bindings
2022-01-07 19:12:06.928 | MOUNT: Path '~/.dosbox' found
2022-01-07 19:12:06.938 | DISPLAY: Text 640x400 (mode 3h) scaling by 1.3x1.6 to 840x630 with 1.20 pixel-aspect
2022-01-07 19:12:06.983 | PACER: Render took 10601us, skipping next
2022-01-07 19:12:07.012 | PACER: Render took 17817us, skipping next
2022-01-07 19:12:07.391 | PACER: Render took 11313us, skipping next
2022-01-07 19:12:07.848 | PACER: Render took 12529us, skipping next
2022-01-07 19:12:08.317 | PACER: Render took 23600us, skipping next
2022-01-07 19:12:08.766 | PACER: Render took 13477us, skipping next
2022-01-07 19:12:09.221 | PACER: Render took 11356us, skipping next
2022-01-07 19:12:09.676 | PACER: Render took 10447us, skipping next
2022-01-07 19:12:10.137 | PACER: Render took 13884us, skipping next
[Thread 0x7fffcdbfb640 (LWP 3741) exited]
[Thread 0x7fffe42a3640 (LWP 3706) exited]
2022-01-07 19:12:10.345 | atexit
[Inferior 1 (process 3699) exited normally]
Comment 2 Bernard Cafarelli gentoo-dev 2022-01-12 11:44:57 UTC
This is a strange one, I suspect the recent bugfix bump 0.78.1 will not help here...

I suspect original dosbox does not show the issue? Have you tried changing USE=opengl and USE=dynrec values (the other USE flags should not have an impact)

One other thing to try is to run the test suite with FEATURES=test, if these fail it could bring useful info.
Comment 3 Francois Chenier 2022-01-12 20:36:03 UTC
(In reply to Bernard Cafarelli from comment #2)
As expected (because dosbox crash before reading dosbox-staging.conf file), no difference if OPENGL or DYNREC flags are enabled or not. My default compilation settings is with both not enabled (which is also the Gentoo default if you don't change any USE flags). I'm just disabling FLUIDSYN because don't need the MIDI stuff.

To compile with TEST flag enabled, I didn't try personally but it seems there is another bug that prevent compiling with that flag on. See
Comment 4 Francois Chenier 2022-01-12 21:14:28 UTC
(In reply to Bernard Cafarelli from comment #2)
> This is a strange one, I suspect the recent bugfix bump 0.78.1 will not help
> here...
It might not be related to this bugfix because I got the same issue with 0.76.x and 0.77.x (so, all the ones presently in Portage tree).
Comment 5 Francois Chenier 2022-01-12 22:22:24 UTC
(In reply to Bernard Cafarelli from comment #2)
> This is a strange one, I suspect the recent bugfix bump 0.78.1 will not help
> here...

I didn't notice we got a new version overnight. Well for that one, wrong answer. The issue has been fixed in 0.78.1 at least with the default USE flags (no OPENGL, no DYNREC). Feel free to close the issue if you think this new version don't need to be tested with OPENGL flag enabled.
Comment 6 Francois Chenier 2022-01-13 09:39:02 UTC
(In reply to Bernard Cafarelli from comment #2)
> This is a strange one, I suspect the recent bugfix bump 0.78.1 will not help
> here...
Forgot what I wrote in Comment 5. The bug is still there in 0.78.1 but the things get muddier because dosbox just works fine outside the debugger in a remote vnc connection

Configuration known to work
 1) In the debugger session (gdb) for KDE5 & openbox
 2) In tigervnc - debugger is not required

Not working
 1) In KDE5 outside a debugger session
 2) In openbox outside a debugger session

Tigervnc & gdb seems to add some overhead that prevent triggering the bug.
Comment 7 Francois Chenier 2022-01-13 12:00:45 UTC
I found it. After analyzing the code, I found the problem is when dosbox try to initialize SDL library. It just goes in nuts on my system if media-libs/libSDL2-2.0.20 is compiled with OPENGL flag enabled. I recompiled libSDL2 disabling opengl flag and now dosbox just works fine.

Offending lines in dosbox-staging-0.73.1 are lines 3924 or 3926 in src/gui/sdlmain.cpp
3924 check_kmsdrm_setting();
3927	E_Exit("Can't init SDL %s", SDL_GetError());
3928 sdl.initialized = true;
3929 // Once initialized, ensure we clean up SDL for all exit conditions
3930 atexit(QuitSDL);