Open Xerkus opened 1 year ago
Are you running in a virtual machine? I was able to reproduce the core in a KVM'd Fedora 36. The root cause seems to be: "OpenGL: Requested single-buffering not available" It may be driver-related.
This is laptop with mobile nvidia quadro K4000M card. Not optimus. Driver is legacy 470
xorg-x11-drv-nvidia-470xx.x86_64 3:470.141.03-1.fc36 @rpmfusion-nonfree-updates
Nvidia driver download page offers driver 418.113 so I would assume it is a problem of this specific system.
I have the same issue on (native) F36 with Intel graphics; I tried a local build. This breaks, too.
I want to report that I have no issue running on newer hardware with latest driver
DF is running Wayland native on nvidia 3080 with PRIME offload on 515.76 driver from negativo.
I do get OpenGL: Requested single-buffering not available
in error message box and I believe it is a red herring caused by some interaction between SDL12-compat and TWBT. SDL2 does not support single-buffering from what I learned, so compat package emulating it.
Game runs perfectly after that initial test.
I found the code with error in renderer_opengl.hpp file:
report_error("OpenGL", "Requested single-buffering not available");
It appears to be calling this function from enabler.cpp:
// Reports an error to the user, using a MessageBox and stderr.
void report_error(const char *error_preface, const char *error_message)
{
char *buf = NULL;
// +4 = +colon +space +newline +nul
buf = new char[strlen(error_preface) + strlen(error_message) + 4];
sprintf(buf, "%s: %s\n", error_preface, error_message);
MessageBox(NULL, buf, "Error", MB_OK);
fprintf(stderr, "%s", buf);
delete [] buf;
}
That in turn calls this from win32_compat.cpp:
int MessageBox(HWND *dummy, const char *text, const char *caption, UINT type)
{
bool toggle_screen = false;
int ret = IDOK;
if (enabler.is_fullscreen()) {
enabler.toggle_fullscreen();
toggle_screen = true;
}
# ifdef __APPLE__ // Cocoa code
if (type & MB_YESNO) {
ret = CocoaAlertPanel(caption, text, "Yes", "No", NULL);
ret = (ret == 0 ? IDNO : IDYES);
} else {
CocoaAlertPanel(caption, text, "OK", NULL, NULL);
}
# else // GTK code
if (getenv("DISPLAY")) {
// Have X, will dialog
GtkWidget *dialog = gtk_message_dialog_new(NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
type & MB_YESNO ?
GTK_MESSAGE_QUESTION :
GTK_MESSAGE_ERROR,
type & MB_YESNO ?
GTK_BUTTONS_YES_NO :
GTK_BUTTONS_OK,
"%s", text);
gtk_window_set_position((GtkWindow*)dialog, GTK_WIN_POS_CENTER_ALWAYS);
gtk_window_set_title((GtkWindow*)dialog, caption);
gint dialog_ret = gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
while (gtk_events_pending())
gtk_main_iteration();
if (type & MB_YESNO) {
switch (dialog_ret) {
default:
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_NO:
ret = IDNO;
break;
case GTK_RESPONSE_YES:
ret = IDYES;
break;
}
}
} else {
// Use curses
init_curses();
erase();
gps.force_full_display_count = 1;
wattrset(*stdscr_p, A_NORMAL | COLOR_PAIR(1));
mvwaddstr(*stdscr_p, 0, 5, caption);
mvwaddstr(*stdscr_p, 2, 2, text);
nodelay(*stdscr_p, false);
if (type & MB_YESNO) {
mvwaddstr(*stdscr_p, 5, 0, "Press 'y' or 'n'.");
refresh();
while (1) {
char i = wgetch(*stdscr_p);
if (i == 'y') {
ret = IDYES;
break;
}
else if (i == 'n') {
ret = IDNO;
break;
}
}
}
else {
mvwaddstr(*stdscr_p, 5, 0, "Press any key to continue.");
refresh();
wgetch(*stdscr_p);
}
nodelay(*stdscr_p, -1);
}
# endif
if (toggle_screen) {
enabler.toggle_fullscreen();
}
return ret;
}
#endif
So from what I observed the segfault happens while trying to render that gtk message dialog: the error message window appears and it has the title but no content and at that exact moment dwarf fortress segfaults. There is also no output to stderr in report_error()
that should follow the message box.
Changing print mode to TWBT or TWBT_Legacy causes DF to segfault and crash on startup. Blank df window briefly appears with blank "error" window over it before closing. I see no error log entries except for the core dump in system journal.
I did a clean install of rpm https://github.com/McArcady/lnp-forge/releases/download/0.47.05-r6/linux-dwarf-pack-0.47.05_r6-1.x86_64.rpm No previous installation existed.
I am not sure if it is a problem with the build or something on my side. This laptop is too weak to decently run DF anyway so I won't be trying to compile locally or debug further for at least a few weeks.