libretro / scummvm

ScummVM main repository
https://www.scummvm.org
GNU General Public License v3.0
4 stars 6 forks source link

[RPi4 armv7] Segmentation fault on any user input #54

Closed morlenxus closed 4 months ago

morlenxus commented 5 months ago

Since a recent update (can't define exactlier) i can't play any of my scummvm games. The games are starting normaly, intro is playing, until i do any user input. It doesn't matter if it's from a gamepad, keyboard or mouse. Once for example i move the mouse, scummvm (retroarch) is crashing.

I'm using todays scummvm and retroarch version, build by retropie script. Other cores work without issues. Also i removed retroarch and scummvm configs, but not difference.

System: rpi4 , Debian bookworm

GDB Output: Thread 1 "retroarch" received signal SIGSEGV, Segmentation fault. 0x993f119c in Common::Keymapper::mapEvent(Common::Event const&, Common::List&) () from /opt/retropie/libretrocores/lr-scummvm/scummvm_libretro.so

Thanks for your help.

spleen1981 commented 5 months ago

Can you attach a retroarch.log? This should have been fixed with 3b466e65be5dfcea7a6c45c28cbd9c5ca73cd7ea, are you at an older commit?

morlenxus commented 4 months ago

retroarch.log

@spleen1981 Log is attached. I also checked, my build is from 27th of march. Also there was no update available - until now (recent commit about the autotune disable).

spleen1981 commented 4 months ago

It looks like an upstream bug (not related to the core itself) occurring on arm 32bit that was solved with https://github.com/libretro/scummvm/commit/3b466e65be5dfcea7a6c45c28cbd9c5ca73cd7ea at least for armv8a, depending on gcc version and optimization level. Weird for armv7 it's still an issue. Can you try to build the core outside retropie build system, i.e. (if building directly on RPi):

git clone https://github.com/scummvm/scummvm
cd scummvm/backends/platform/libretro
make platform=armv7-neon > build.log 2>&1

You will find a scummvm_libretro.so to test in scummvm/backends/platform/libretro and a build.log that you can share, along with your gcc version.

morlenxus commented 4 months ago

build.log

@spleen1981 Even with this compiled version i get the segfault. Attached is the build.log as you suggested.

spleen1981 commented 4 months ago

What's the output of gcc --version? Can you make clean, change here from -O3 to -O0 and build it again?

morlenxus commented 4 months ago

gcc --version: gcc (Raspbian 12.2.0-14+rpi1) 12.2.0

Now this version is running and working with inputs! Attached is the build.log build.log

@spleen1981

spleen1981 commented 4 months ago

Ok, looks like the same bug as above... the root cause upstream is not clear to me, maybe a gcc bug (as building with v10.2 should work fine). Anyways can you do the same test above compiling with -O2 (and -O1 if -O2 is not working)? You need to make clean before each test. I would like to use the highest optimization available in the workaround to be merged.

morlenxus commented 4 months ago

build_O2.log

@spleen1981 -O2 wasn't working, in case it's interesting for your i attached the build.log. Currently rebuilding with -O1

morlenxus commented 4 months ago

@spleen1981 Final results: Only -O0 works stable, but was slow. -O1 was unstable when playing.

I compiled with gcc-10 which is stable and fast at -O3.

spleen1981 commented 4 months ago

Can you do one last test with gcc-12, -O3 and removing this line?

morlenxus commented 4 months ago

@spleen1981 Hey, with that change and still using -O3 does work!

spleen1981 commented 4 months ago

Possible fix submitted upstream https://github.com/scummvm/scummvm/pull/5760

spleen1981 commented 4 months ago

Fixed with a72296be87cd3a3f549545f3aec50f7273098da1