Open ghost opened 3 years ago
Reposting my answer from https://github.com/libretro/RetroArch/issues/12250
Crashing for me too on load content, with a Samsung Galaxy A5 2016 (it's a bit old, still running with Android 7, 32bit), I got a crash log by using adb logcat *:F
, I think it's the right way?:
--------- beginning of crash
04-08 15:57:19.574 8711 8733 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x7c in tid 8733 (Thread-5)
04-08 15:57:19.810 8857 8857 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-08 15:57:19.810 8857 8857 F DEBUG : Build fingerprint: 'samsung/a5xeltexx/a5xelte:7.0/NRD90M/A510FXXS8CTI7:user/release-keys'
04-08 15:57:19.810 8857 8857 F DEBUG : Revision: '4'
04-08 15:57:19.810 8857 8857 F DEBUG : ABI: 'arm'
04-08 15:57:19.810 8857 8857 F DEBUG : pid: 8711, tid: 8733, name: Thread-5 >>> com.retroarch.ra32 <<<
04-08 15:57:19.810 8857 8857 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x7c
04-08 15:57:19.811 8857 8857 F DEBUG : r0 d5fe2480 r1 ca6273e0 r2 ca6274e0 r3 00000000
04-08 15:57:19.811 8857 8857 F DEBUG : r4 ca919a88 r5 ca6271ec r6 00000000 r7 00000002
04-08 15:57:19.811 8857 8857 F DEBUG : r8 0001d7cc r9 000236f8 sl 00000001 fp eaa7f7e8
04-08 15:57:19.811 8857 8857 F DEBUG : ip eaa7f7ab sp eaa7f7a0 lr ca584a67 pc ca54f000 cpsr 60010030
04-08 15:57:19.828 8857 8857 F DEBUG :
04-08 15:57:19.828 8857 8857 F DEBUG : backtrace:
04-08 15:57:19.831 8857 8857 F DEBUG : #00 pc 0002a000 /data/data/com.retroarch.ra32/cores/bsnes_libretro_android.so
04-08 15:57:19.831 8857 8857 F DEBUG : #01 pc 0005fa63 /data/data/com.retroarch.ra32/cores/bsnes_libretro_android.so
04-08 15:57:19.831 8857 8857 F DEBUG : #02 pc 000481d5 /data/data/com.retroarch.ra32/cores/bsnes_libretro_android.so
04-08 15:57:19.831 8857 8857 F DEBUG : #03 pc 005295a4 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (core_run+292)
04-08 15:57:19.831 8857 8857 F DEBUG : #04 pc 00510538 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (runloop_iterate+1640)
04-08 15:57:19.831 8857 8857 F DEBUG : #05 pc 0050fbcc /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (rarch_main+1044)
04-08 15:57:19.831 8857 8857 F DEBUG : #06 pc 00752880 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
04-08 15:57:19.831 8857 8857 F DEBUG : #07 pc 00618498 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
04-08 15:57:19.831 8857 8857 F DEBUG : #08 pc 00047f93 /system/lib/libc.so (_ZL15__pthread_startPv+22)
04-08 15:57:19.832 8857 8857 F DEBUG : #09 pc 0001a161 /system/lib/libc.so (__start_thread+6)
Tested with Super Mario World, I even added the BIOS files just in case but I don't think they're required for SMW.
Safe to assume this only happens with 32bit Android installations of RetroArch.
Revisiting this issue, I wanted to try getting a better backtrace so I built the core with NDK_DEBUG=1
and the core launches...
Maybe something to do with the compiler optimisation stuff (I mean like -O0 vs. -O2 or whatever the non-debug build is using)?
I analyzed the same crash for bsnes-hd some time ago. I didn't find a fix (I'm not a C++ or Android guy, so someone more skilled in the right areas will surely figure it out.). I did however find one piece of information that might help and also provides a workaround:
The crash only happens with newer NDKs. Or rather it does work with the rather old Android NDK r20b (June 2019), see: https://github.com/DerKoun/bsnes-hd/blob/f46b6d6368ea93943a30b5d4e79e8ed51c2da5e8/.github/workflows/CI.yml#L206
As a temporary workaround you can probably use that build script with bsnes (or download the bsnes-hd Android ZIP if that works for you) if you are fine with manually installing the core.
I hope the version information helps debugging this.
Idk much about compilation stuff, even less about Android, but I redid some tests with the Libretro build environment with NDK_DEBUG=1
:
ld: error: ../../../libco/arm.c:73:(.text.co_switch+0xA): branch and link relocation: R_ARM_THM_CALL to non STT_FUNC symbol: co_swap_function interworking not performed; consider using directive '.type co_swap_function, %function' to give symbol type STT_FUNC if interworking between ARM and Thumb is required
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/android-sdk-linux/ndk/22.0.7026061/build/core/build-binary.mk:728: /builds/bslenul/bsnes/bsnes/target-libretro/obj/local/armeabi-v7a/libretro.so] Error 1
********** Crash dump: **********
Build fingerprint: 'samsung/a5xeltexx/a5xelte:7.0/NRD90M/A510FXXS8CTI7:user/release-keys'
#00 0x00061000 /data/data/com.retroarch.ra32/cores/bsnes_libretro_android.so
??
??:0:0
#01 0x000b892f /data/data/com.retroarch.ra32/cores/bsnes_libretro_android.so
SuperFamicom::Scheduler::enter()
/bsnes-libretro/bsnes/target-libretro/jni/../../../bsnes/sfc/sfc.hpp:40:7
SuperFamicom::System::run()
/bsnes-libretro/bsnes/target-libretro/jni/../../../bsnes/sfc/system/system.cpp:13:13
#02 0x00076617 /data/data/com.retroarch.ra32/cores/bsnes_libretro_android.so
retro_run
/bsnes-libretro/bsnes/target-libretro/jni/../../../bsnes/target-libretro/libretro.cpp:771:13
#03 0x0075c6cc /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (core_run+256)
#04 0x0074d498 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (runloop_iterate+16120)
#05 0x00749184 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so (rarch_main+884)
#06 0x00960a18 /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
#07 0x008022ac /data/app/com.retroarch.ra32-1/lib/arm/libretroarch-activity.so
#08 0x00047f93 /system/lib/libc.so (_ZL15__pthread_startPv+22)
#09 0x0001a161 /system/lib/libc.so (__start_thread+6)
Crash dump is completed
So maybe it has something to do with that libco error that pops with -O1? 🤔
And yeah, as mentioned by DerKoun above, no crash when built with NDK 20.1.5948944 (r20b).
Description
If you choose any of the bsnes cores and try to load content, RetroArch immediately crashes. Doesn't happen with Snes9x core.
Expected behavior
The content loads.
Actual behavior
RetroArch crashes.
Steps to reproduce the bug
Bisect Results
Happens with fresh install as well, and doesn't happen on Windows 10 20H2.
Version/Commit
You can find this information under Information/System Information
Environment information
Log
Log