melonDS-emu / melonDS

DS emulator, sorta
https://melonds.kuribo64.net
GNU General Public License v3.0
2.98k stars 493 forks source link

Crash when running melonDS under Debian #2049

Open vitor251093 opened 1 month ago

vitor251093 commented 1 month ago

The latest source code isn't executing in Debian 11. It builds, but it gives a Segmentation Fault when trying to run it. This is the stack trace (gdb):

#0  0x00007ffff5eb7d4a in __GI___libc_free (mem=0x555002c58907) at ./malloc/malloc.c:3362
#1  0x0000555555621f56 in g_string_free (str=0x555557917c00, free_segment=<optimized out>)
    at //melonds/src/frontend/libslirp/glib/glib.c:36
#2  0x00007ffff0a082fc in  () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#3  0x00007ffff559c6c1 in g_option_context_parse () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x00007ffff0a08078 in gtk_parse_args () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#5  0x00007ffff0a080e6 in gtk_init_check () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#6  0x00007ffff0a08139 in gtk_init () at /lib/x86_64-linux-gnu/libgtk-3.so.0
#7  0x00007ffff1dc7406 in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
#8  0x00007ffff1dc152c in  () at /usr/lib/x86_64-linux-gnu/qt5/plugins/platformthemes/libqgtk3.so
#9  0x00007ffff6b266f4 in QPlatformThemeFactory::create(QString const&, QString const&) () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#10 0x00007ffff6b33630 in QGuiApplicationPrivate::createPlatformIntegration() () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#11 0x00007ffff6b349b0 in QGuiApplicationPrivate::createEventDispatcher() () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#12 0x00007ffff66b7f15 in QCoreApplicationPrivate::init() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#13 0x00007ffff6b3786c in QGuiApplicationPrivate::init() () at /lib/x86_64-linux-gnu/libQt5Gui.so.5
#14 0x00007ffff7768519 in QApplicationPrivate::init() () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#15 0x00005555555afac5 in MelonApplication::MelonApplication(int&, char**) (this=0x7fffffffdba0, argc=<optimized out>, argv=<optimized out>)
    at //melonds/src/frontend/qt_sdl/main.cpp:261
#16 0x00005555555afd4f in main(int, char**) (argc=<optimized out>, argv=0x7fffffffdd88)
    at //melonds/src/frontend/qt_sdl/main.cpp:304
vitor251093 commented 1 month ago

I've found a workaround. It seems that adding -DUSE_SYSTEM_LIBSLIRP=ON to the cmake flags while building does create a runnable binary. This does not fix the bug at glib.c, but if you are facing the issue, this flags works right now

CasualPokePlayer commented 1 month ago

This seems like just the fault of trying to stub glib while also actually having glib linked in regardless (which is sometimes (often?) going to be the case on Linux if just because of GTK). This issue ultimately is just due to ELF symbol interposition (i.e. non-issue on Windows and macOS which don't use ELF for their executable binary format). This might be fixed by hiding the symbols (-fvisibility=hidden)?