ptitSeb / box64

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

wine-staging-wow64-9.6 failed to start on aarch64 #1449

Open mio-19 opened 4 months ago

mio-19 commented 4 months ago

I built the package from AUR on Archlinux x86_64 and installed on Archlinux arm aarch64 chroot on Android. https://aur.archlinux.org/packages/wine-staging-wow64?all_deps=1#pkgdeps

box64 --version
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT PageSize:4096 Running on Cortex-A510 Cortex-A715 Cortex-A710 - with 8 Cores
Will use Hardware counter measured at 19.2 MHz emulating 614 MHz
Params database has 61 entries
Box64 with Dynarec v0.2.7 b9613927 built on Apr  7 2024 04:50:28
wine64
Dynarec for ARM64, with extension: ASIMD AES CRC32 PMULL ATOMICS SHA1 SHA2 USCAT FLAGM FLAGM2 FRINT PageSize:4096 Running on Cortex-A510 Cortex-A715 Cortex-A710 - with 8 Cores
Will use Hardware counter measured at 19.2 MHz emulating 614 MHz
Params database has 61 entries
Box64 with Dynarec v0.2.7 b9613927 built on Apr  7 2024 04:50:28
BOX64: Wine64 detected, WINEPRELOADRESERVE=""
BOX64: Didn't detect 48bits of address space, considering it's 39bits
Counted 20 Env var
BOX64 LIB PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/:/lib/x86_64-linux-gnu/:/usr/lib/x86_64-linux-gnu/
BOX64 BIN PATH: ./:bin/:/home/user/.local/bin/:/usr/local/sbin/:/usr/local/bin/:/usr/bin/:/usr/bin/site_perl/:/usr/bin/vendor_perl/:/usr/bin/core_perl/
Looking for /usr/bin/wine64
Apply RC params for wine64
Applying BOX64_MAXCPU=64
Rename process to "wine"
Apply RC params for wine
Applying BOX64_MAXCPU=64
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) libresolv.so.2
Using native(wrapped) librt.so.1
Using native(wrapped) libbsd.so.0
FillBlock triggered a segfault at 0x1350 from 0x35069454
FillBlock at 0x1350 triggered a segfault, canceling
4405| Strange SIGSEGV with Access error on 0x35025f6c for 0x1350, db=(nil), prot=0x7 (old_addr=(nil), Lock=0x0)
4405| Strange SIGSEGV with Access error on 0x35025f6c for 0x1350, db=(nil), prot=0x7 (old_addr=0x1350, Lock=0x0)
4405|SIGSEGV @0x35025f6c (???(/usr/bin/wine64+0x825f6c)) (x64pc=0x1350/???:"???", rsp=0x7c637ffb28, stack=0x7c63000000:0x7c63800000 own=(nil) fp=0x7c637ffb30), for accessing 0x1350 (code=2/prot=7), db=(nil)((nil):(nil)/(nil):(nil)/???:clean, hash:0/0) handler=(nil)
RSP-0x20:0x0000000000000000 RSP-0x18:0x0000000000000000 RSP-0x10:0x0000000000000000 RSP-0x08:0x0000000000000000
RSP+0x00:0x0000000000010080 RSP+0x08:0x0000000000000000 RSP+0x10:0x0000000100001285 RSP+0x18:0x0000007c637ffb48
RAX:0x0000000000000000 RCX:0x0000000000000000 RDX:0x0000007c637ffb68 RBX:0x0000000000000000
RSP:0x0000007c637ffb28 RBP:0x0000007c637ffb30 RSI:0x0000007c637ffb58 RDI:0x0000000000000001
 R8:0x0000000000000000  R9:0x0000000000010080 R10:0x0000000000000000 R11:0x0000000000000000
R12:0x0000000000000000 R13:0x0000000000000000 R14:0x0000000000000000 R15:0x0000000000000000
ES:0x002b CS:0x0033 SS:0x002b DS:0x002b FS:0x0043 GS:0x0053
fish: Job 1, 'wine64' terminated by signal SIGSEGV (Address boundary error)
mio-19 commented 4 months ago

https://github.com/ptitSeb/box64/issues/1393

EuphoricCatface commented 4 months ago

I want to see this actually working! Since ArchARM lacks lib32 repository, WoW64 will be probably the easiest way to get 32bit Windows applications running on it. (Unless WineHQ officially releases WoW64 enabled packages)

EuphoricCatface commented 4 months ago

This might be a dumb experiment, but here's what I tried today to make WoW64 work: (This is NOT an attempt to install and/or run the wine package of x86_64 Arch Linux or any variant of it)

With the wine64 binary from the Debian package, when I try to run a Win32 executable, I realized Wine says it will try the experimental WoW64 mode, and then fails to load C:\windows\syswow64\ntdll.dll. Indeed, C:\windows\syswow64 folder is empty in this case. Whereas, when I deleted wine binary on my desktop Arch Linux and tried to run a Win32 executable with wine64 binary, it was failing because it couldn't find the deleted binary. Maybe the Debian package is actually able to do WoW64 but just does not create WoW64 support inside the wineprefixes?

So, I installed wine-wow64 on my desktop, installed the same version (9.6) of Debian Wine on the ARM64 system, and then copied over the folder C:\windows\syswow64 under the wineprefix. However, the recipient Wine system was still failing to find C:\windows\syswow64\ntdll.dll.

I thought maybe other components inside the wineprefix could not handle the WoW64 part, so throwing in more DLLs might solve the problem. I considered copying over the system32 folder, then, went fsck it, to decide to copy over whole windows folder. So, I created a new wineprefix, deleted the windows folder, copied one over from the desktop.

That didn't solve the problem though. It seems like the components inside the wineprefix are not able to communicate with the wineserver or something, and Wine eventually fails with a message saying it couldn't run explorer. I guess there are some sort of mismatch because of all the critical DLLs being replaced. From this point, without proper knowledge of which DLLs are such critical ones, I wasn't able to proceed anymore.

EuphoricCatface commented 4 months ago

OH SH!T IT WORKS?!

Screenshot 2024-04-20 8 13 50 PM

In addition to the syswow64 folder copied as mentioned above, I have copied over /usr/lib/wine/i386-windows library folder. Since I have Wine installed in ~/.local/opt/wine-devel9.6, I pasted it in ~/.local/opt/wine-devel9.6/lib64/wine/.

EDIT: The i386-windows folder seems to be available with the 32bit version of the Wine package. That is, it might be possible to set up WoW64 entirely with the WineHQ Debian packages, without having to have an installation of wine-wow64 or wine-staging-wow64 on your x64 machine.

mio-19 commented 4 months ago

That's great! There is some issue preventing any wine varient built by archhlinux toolchain to work.

It might be possible to build a wow64 version on debian and use it without hacking wine64 into wine-wow64

ptitSeb commented 4 months ago

Wine with new WOW64 works fine with box64. You can find build in pi-apps or in Kron4ek CI.

Using a too modern glibc / or some option for to modern cpu might cause issue tho. I don't have acces to the arch built version of Wine, so cannot debug the issue on my side.

thw26 commented 1 month ago

FWIW, Arch Linux's wine package can be downloaded here in the top right corner. The link is named "Download From Mirror"

https://archlinux.org/packages/multilib/x86_64/wine/