ptitSeb / box64

Box64 - Linux Userspace x86_64 Emulator with a twist, targeted at ARM64 Linux devices
https://box86.org
MIT License
3.93k stars 290 forks source link

The Binding of Isaac: Rebirth (v2022.12.08 with DLCs Afterbirth and Afterbirth+, Linux x64, Steam) Segmentation fault #542

Closed ricoazzurro closed 1 year ago

ricoazzurro commented 1 year ago

Description

The Binding of Isaac Rebirth v2022.12.08 with DLC Afterbirth and Afterbirth+, Linux x64, Steam, With Goldberg. Rock 5B, Box64 with Dynarec v0.2.1 f82a6b7, PAN_MESA_DEBUG=gofaster,gl3

Not working, ending with Segmentation fault. Also reported here, https://github.com/ptitSeb/box86-compatibility-list/issues/240

Already tested:

My final log, at this point, I don't know how to carry on further.

rico [ ~/the_binding_of_isaac_rebirth ]$ LD_LIBRARY_PATH="lib64:/home/rico/deb/usr/lib/x86_64-linux-gnu:/home/rico/deb/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH" box64 ./isaac.x64
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS PageSize:4096 Running on Cortex-A55 Cortex-A76 with 8 Cores
Params database has 21 entries
Using bash "/home/rico/box64/tests/bash"
Box64 with Dynarec v0.2.1 f82a6b7 built on Mar  8 2023 20:13:59
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 58 Env var
Looking for ./isaac.x64
Rename process to "isaac.x64"
Using native(wrapped) libGL.so.1
Using native(wrapped) libGLU.so.1
Using native(wrapped) libX11.so.6
Using native(wrapped) libXxf86vm.so.1
Using native(wrapped) libXext.so.6
Using native(wrapped) libxcb.so.1
Using native(wrapped) libXau.so.6
Using native(wrapped) libdl.so.2
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux-x86-64.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libutil.so.1
Using native(wrapped) librt.so.1
Using native(wrapped) libXdmcp.so.6
Using native(wrapped) libXrandr.so.2
Using native(wrapped) libXrender.so.1
Using native(wrapped) libXi.so.6
Using native(wrapped) libopenal.so.1
Using emulated lib64/libsteam_api.so
Using emulated /lib/x86_64-linux-gnu/libstdc++.so.6
Using native(wrapped) libm.so.6
Using emulated /lib/x86_64-linux-gnu/libgcc_s.so.1
Initializing Theora Playback Library (1.1)
  - libtheora version: Xiph.Org libtheora 1.2.0alpha 20100924 (Ptalarbvorm)
  - libvorbis version: Xiph.Org libVorbis 1.3.4
------------------------------------
Using emulated /home/rico/deb/usr/lib/x86_64-linux-gnu/liballegro.so.5.0
Using native(wrapped) libXcursor.so.1
Using native(wrapped) libXpm.so.4
Using native(wrapped) libXinerama.so.1
Using native(wrapped) libOpenGL.so.0
Using native(wrapped) libGLX.so.0
Using native(wrapped) libdbus-1.so.3
2043|SIGSEGV @0x7f8a9aa050 (???(0x7f8a9aa050)) (x64pc=0x8fc998//home/rico/the_binding_of_isaac_rebirth/isaac.x64:"/home/rico/the_binding_of_isaac_rebirth/isaac.x64/_Z17_glfwPlatformInitv + 472", rsp=0x101ffef60, stack=0x101800000:0x102000000 own=(nil) fp=0x4ec76cc0), for accessing 0xc (code=1/prot=0), db=0x7f8a9f8ad8(0x7f8a9aa050:0x7f8a9aca1c/0x8fc998:0x8fd0cb//home/rico/the_binding_of_isaac_rebirth/isaac.x64/_Z17_glfwPlatformInitv + 472:clean, hash:2a1f5242/2a1f5242) handler=(nil)
RAX:0x0000000000000000 RCX:0x0000000000000000 RDX:0x0000000000000000 RBX:0x0000000000000001 
RSP:0x0000000101ffef60 RBP:0x000000004ec76cc0 RSI:0x0000000000000001 RDI:0x0000007f8da66a84 
 R8:0x0000000000000001  R9:0x0000000000e04db4 R10:0x2dc030705ed92be0 R11:0x2f6c61636f6c2e2f 
R12:0x0000000000000004 R13:0x0000000000000000 R14:0x0000000000000000 R15:0x0000000000000000 
RSP-0x20:0x000000004e665ca8 RSP-0x18:0x000000004df87cd0 RSP-0x10:0x0000000000000194 RSP-0x08:0x00000000008fc998
RSP+0x00:0x0000000101fff000 RSP+0x08:0x000000004e64eff0 RSP+0x10:0x000000004ebef8c0 RSP+0x18:0x000000004ebef8d4
Segmentation fault (core dumped)

Tested on

RADXA Rock 5B (rk3588) 16GB LFS, BSP kernel 5.10.110+ (rkr3.6), Gnome 43.4, Box64 with Dynarec v0.2.1 f82a6b7 1080p, default game setting

Reproduce

# game dir is prepared in $HOME/the_binding_of_isaac_rebirth

# read launching scrpits in game folder, I run the game with the following cmds, lib64 is Goldberg's libsteam_api.so. 
cd ~/the_binding_of_isaac_rebirth
LD_LIBRARY_PATH="lib64:$LD_LIBRARY_PATH" box64 ./isaac.x64

# then I got isaac-1.log
# Error loading needed lib liballegro.so.5.0
# Warning: Cannot dlopen("liballegro.so.5.0"/0x9a677b, 1)
# Using native(wrapped) libdbus-1.so.3
# 1517|SIGSEGV @0x7fbc07c628 (???(0x7fbc07c628)) (x64pc=0x8fc998//home/rico/the_binding_of_isaac_rebirth/isaac.x64:"/home/rico/the_binding_of_isaac_rebirth/isaac.x64/_Z17_glfwPlatformInitv + 472", rsp=0x101ffefb0, stack=0x101800000:0x102000000 own=(nil) fp=0x4471c750), for accessing 0xc (code=1/prot=0), db=0x7fbc16e4d0(0x7fbc07c628:0x7fbc07eff4/0x8fc998:0x8fd0cb//home/rico/the_binding_of_isaac_rebirth/isaac.x64/_Z17_glfwPlatformInitv + 472:clean, hash:2a1f5242/2a1f5242) handler=(nil)
# RAX:0x0000000000000000 RCX:0x0000000000000000 RDX:0x0000000000000000 RBX:0x0000000000000001 
# RSP:0x0000000101ffefb0 RBP:0x000000004471c750 RSI:0x0000000000000001 RDI:0x0000007fbed76a84 
#  R8:0x0000000000000001  R9:0x0000000000e04db4 R10:0x956dc8f516c2ab39 R11:0x2f6c61636f6c2e2f 
# R12:0x0000000000000000 R13:0x0000000000000000 R14:0x0000000000000000 R15:0x0000000000000000 
# RSP-0x20:0x00000000442c3ca8 RSP-0x18:0x0000000043beab60 RSP-0x10:0x0000000000000194 RSP-0x08:0x00000000008fc998
# RSP+0x00:0x0000000101fff050 RSP+0x08:0x00000000442b1d10 RSP+0x10:0x00000000442b1fa0 RSP+0x18:0x00000000442b1fb4
# Segmentation fault (core dumped)

# So I went to solve the missing libs. libs for game testing are stored in $HOME/deb
mkdir -pv ~/deb
cd ~/deb

# liballegro.so.5.0 (x64)
# https://packages.debian.org/stable/libs/liballegro5.2  //can not find liballegro.so.5.0 even in older branch
# https://github.com/liballeg/allegro5/releases/tag/5.0.11 //the pkg repo, I don't have x64 linux at hand, so can't compile myself

wget http://ftp.debian.org/debian/pool/main/a/allegro5/liballegro5.2_5.2.6.0-3_amd64.deb
ar -x liballegro5.2_5.2.6.0-3_amd64.deb
tar -xf data.tar.xz

# symlink to liballegro.so.5.0 see if I can trick the game.
cd usr/lib/x86_64-linux-gnu
ln -sfv liballegro_color.so.5.2.6 liballegro.so.5.0

# run the game again, I got isaac-2.log, isaac-3.log, more missing libs.
cd ~/the_binding_of_isaac_rebirth
LD_LIBRARY_PATH="lib64:/home/rico/deb/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" box64 ./isaac.x64

# Error initializing native libGLX.so.0 (last dlerror is libGLX.so.0: cannot open shared object file: No such file or directory)
# Error initializing native libGLX.so.0 (last dlerror is libGLdispatch.so.0: cannot open shared object file: No such file or directory)
# Hinted by solving stardew last time, when seeing 'cannot open shared object file', I need native aarch64 libs.
cd ~/deb

# libGLX.so.0 (native aarch64) //from arch pkg page, I'm worried if I install this one will break my mesa, so I sideload it.
# https://packages.debian.org/bullseye/libs/libglx0
wget http://ftp.debian.org/debian/pool/main/libg/libglvnd/libglx0_1.3.2-1_arm64.deb
ar -x libglx0_1.3.2-1_arm64.deb
tar -xf data.tar.xz

# libGLdispatch.so.0 (native aarch64) //a lot of pkgs at debian include dispatch, from arch pkg page, I think I need glvnd
# https://packages.debian.org/bullseye/libs/libglvnd0
wget http://ftp.debian.org/debian/pool/main/libg/libglvnd/libglvnd0_1.3.2-1_arm64.deb
ar -x libglvnd0_1.3.2-1_arm64.deb
tar -xf data.tar.xz

# run the game again, I got isaac-4.log, as attached above as my final log.
cd ~/the_binding_of_isaac_rebirth
LD_LIBRARY_PATH="lib64:/home/rico/deb/usr/lib/x86_64-linux-gnu:/home/rico/deb/usr/lib/aarch64-linux-gnu:$LD_LIBRARY_PATH" box64 ./isaac.x64

# I don't know how to carry on, liballegro.so.5.0? dbus?

ls -lah /usr/lib/libdbus-1*

# lrwxrwxrwx 1 root root   19 Mar  2 10:11 /usr/lib/libdbus-1.so -> libdbus-1.so.3.32.2
# lrwxrwxrwx 1 root root   19 Mar  2 10:11 /usr/lib/libdbus-1.so.3 -> libdbus-1.so.3.32.2
# -rwxr-xr-x 1 root root 541K Mar  2 10:11 /usr/lib/libdbus-1.so.3.32.2

# my dbus is compiled following instructiong at https://linuxfromscratch.org/blfs/view/systemd/general/dbus.html
# attached 

Logs

isaac-1.log isaac-2.log isaac-3.log isaac-4.log

My dbus lib

libdbus-1.so.3.32.zip

Status

Previous behavior:

Working via box86, https://github.com/ptitSeb/box86-compatibility-list/issues/4

Current behavior:

Segmentation fault via box64

Screenshots

OpenGL

OpenGL 2

Additional Information

PAN_MESA_DEBUG=gofaster,gl3 Box64 with Dynarec v0.2.1 f82a6b7, compiled with -DRK3588=1

Thanks again for the awesome project. Since Isaac might be Steam's icon, it will be nice to have it working :) I wrote the above niebie stuff, hope it won't bother you too much and issue post here may benifit more gamers. Have a lovely day :)

ricoazzurro commented 1 year ago

hmm, I have libglx.so in my system.

rico [ ~ ]$ ls -lah /usr/lib/xorg/modules/extensions/libglx* -rwxr-xr-x 1 root root 419K Mar 1 08:12 /usr/lib/xorg/modules/extensions/libglx.so

ricoazzurro commented 1 year ago

More tests, no luck. same error log

mkdir build && cd build &&

meson setup \ --prefix=/usr \ --buildtype=release \ .. && ninja

DESTDIR=${PWD}/temp-install ninja install rm -rf temp-install/usr/lib/pkgconfig

sudo chown -R root:root temp-install

sudo mkdir -pv /opt/box-libs/aarch64 sudo cp -av temp-install/usr/lib/* /opt/box-libs/aarch64

cd ../.. sudo rm -rf libglvnd

ricoazzurro commented 1 year ago

You've found the issue!

As pointed out by Seb,

it's strange that the libs you are loading are not the same you load OpenGL/GLX, while I use the traditionnal libGL

Here comes the wierd thing, I can launch it in pure X11, startx , then in twm and xterm, just ./isaac.x64, I can launch it without additional x86 or aarch64 libs.

So the issue is related to my xwayland.

To verify, I started gnome via gdm, so my gnome is running under wayland. Then I opened xterm and ./isaac.x64, no luck, same issue as before.

From this point, I knew,

The questions are,

Will test libmali blob driver via dri2to3 https://gitlab.com/panfork/dri2to3

Thanks for testing the game. You are absolutely right and amazing noticing such a small difference.