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: could not load kernel32.dll, status c0000135 #263

Open olevenets2 opened 2 years ago

olevenets2 commented 2 years ago

Hi, all!

i installed two versions (i386 and x86_64) of wine stable 7.0, it works very well with box86, but when i try to make prefix a 64bit application in box64 i get error:

pi@raspberrypi:~ $ WINEPREFIX=~/.wine64 WINEARCH=win64 wine winecfg
Box86 with Dynarec v0.2.5 ca850b3d built on Mar 19 2022 23:02:46
Box86 with Dynarec v0.2.5 ca850b3d built on Mar 19 2022 23:02:46
Dynarec for ARM64, with extension: ASIMD CRC32 PageSize:4096
Box64 with Dynarec v0.1.7 5a563f1 built on Mar 19 2022 23:22:43
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 51 Env var
Looking for /home/pi/wine/bin/wineserver
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) librt.so.1
wine: could not load ntdll.so: Cannot dlopen("/home/pi/wine/bin/../lib64/wine/x86_64-unix/ntdll.so"/0xa06e40e0, 2)

0024:err:environ:run_wineboot failed to start wineboot c00000e5
wine: could not load kernel32.dll, status c0000135

can i fix this error somehow or now Wine x86_64 doesn't work correctly on 64bit RPI OS?

ptitSeb commented 2 years ago

not sure what is happening. Try to update both box86 and box64 first, as a lot of wine/proton work as been done lately. It might just fix the issue.

olevenets2 commented 2 years ago

i updated box86 and box64 but still getting the same error

ptitSeb commented 2 years ago

This seems to be related to wineprefix issue, when mixing 32bits and 64bits version. have you tried to remove your .wine64 prefix?

olevenets2 commented 2 years ago

yes, rm -rf .wine64 gives nothing

ptitSeb commented 2 years ago

you don't need to use WINEARCH, at least, I don't use it on my side, and it works fine. Try to run with BOX86_LOG=1 to have more detail with box86.

olevenets2 commented 2 years ago
pi@raspberrypi:~ $ BOX86_LOG=1 WINEPREFIX=~/.wine64 WINEARCH=win64 wine winecfg
Debug level is 1
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Box86 with Dynarec v0.2.5 dc461d4d built on Mar 30 2022 15:41:49
BOX86: Wine detected, WINEPRELOADRESERVE=""
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/
Using default BOX86_PATH: ./:bin/
Counted 51 Env var
Looking for /usr/local/bin/wine
argv[1]="winecfg"
Using native(wrapped) libdl.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) librt.so.1
Using emulated /home/pi/wine/bin/../lib/wine/i386-unix/ntdll.so
Debug level is 1
Dynarec for ARMv8, with extension: HALF FAST_MULT EDSP NEON VFPv4 IDIVA PageSize:4096
Box86 with Dynarec v0.2.5 dc461d4d built on Mar 30 2022 15:41:49
BOX86: Wine detected, WINEPRELOADRESERVE=""
Using default BOX86_LD_LIBRARY_PATH: ./:lib/:lib32/:x86/:i686/
Using default BOX86_PATH: ./:bin/
Counted 52 Env var
Looking for /home/pi/wine/bin/wine
argv[1]="winecfg"
Using native(wrapped) libdl.so.2
Using native(wrapped) libpthread.so.0
Using native(wrapped) libc.so.6
Using native(wrapped) ld-linux.so.2
Using native(wrapped) librt.so.1
Using emulated /home/pi/wine/bin/../lib/wine/i386-unix/ntdll.so
Dynarec for ARM64, with extension: ASIMD CRC32 PageSize:4096
Box64 with Dynarec v0.1.7 3f641c2 built on Mar 30 2022 16:07:04
Using default BOX64_LD_LIBRARY_PATH: ./:lib/:lib64/:x86_64/:bin64/:libs64/
Using default BOX64_PATH: ./:bin/
Counted 53 Env var
Looking for /home/pi/wine/bin/wineserver
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) librt.so.1
Using emulated /home/pi/wine/lib/wine/i386-unix/libwine.so.1
wine: could not load ntdll.so: Cannot dlopen("/home/pi/wine/bin/../lib64/wine/x86_64-unix/ntdll.so"/0x6ae32210, 2)

0024:err:environ:run_wineboot failed to start wineboot c00000e5
Error loading needed lib /home/pi/wine/lib/wine/i386-unix/start.so
Warning: Cannot dlopen("/home/pi/wine/lib/wine/i386-unix/start.so"/0x64930faf, 2)
wine: could not load kernel32.dll, status c0000135
ptitSeb commented 2 years ago

Are you sure your 64bits version of wine is complete? the last error wine: could not load ntdll.so: Cannot dlopen("/home/pi/wine/bin/../lib64/wine/x86_64-unix/ntdll.so"/0x6ae32210, 2) seems to indicate box64 cannot find the file. Does it exist?

Also, it load Using emulated /home/pi/wine/lib/wine/i386-unix/libwine.so.1 for wineserver wich should be a 64bits process there, and that is suspiocious!

olevenets2 commented 2 years ago

hmm, ntdll.so is ok

pi@raspberrypi:~ $ find ~/wine/ -name ntdll.so
/home/pi/wine/lib64/wine/x86_64-unix/ntdll.so
/home/pi/wine/lib/wine/i386-unix/ntdll.so

and also libwine.so.1

pi@raspberrypi:~ $ find ~/wine/ -name libwine.so.1
/home/pi/wine/lib64/wine/x86_64-unix/libwine.so.1
/home/pi/wine/lib/wine/i386-unix/libwine.so.1

how can i force when calling wine64 to use x86_64 libraries?

ptitSeb commented 2 years ago

You can't. It's automatic. Can you do file /home/pi/wine/lib/wine/i386-unix/libwine.so.1 and file /home/pi/wine/lib64/wine/x86_64-unix/ntdll.so

ptitSeb commented 2 years ago

Mmm I think the 32bits llibwine loding message is just from box86, not the box64 there. So the question is why box64 doesn't load that lib. Try to run with BOX64.LOG=2 to have more details on box64 side.

olevenets2 commented 2 years ago

file

pi@raspberrypi:~ $ file /home/pi/wine/lib/wine/i386-unix/libwine.so.1
/home/pi/wine/lib/wine/i386-unix/libwine.so.1: symbolic link to libwine.so.1.0
pi@raspberrypi:~ $ file /home/pi/wine/lib64/wine/x86_64-unix/ntdll.so
/home/pi/wine/lib64/wine/x86_64-unix/ntdll.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5131c1e09591cd6c00e1ae55d9373396685f29e9, stripped

BOX64.LOG

https://paste.ee/p/tyqi7

ptitSeb commented 2 years ago

I don't see anything wrong in those logs. And logs from box86 and box64 are mixed, making it difficult to follow. Did you try to run without the WINEARCH=win64 (I never need to use that on my side)?

olevenets2 commented 2 years ago

yes, it's the same error with ntdll.so

https://paste.ee/p/MH3SI

ptitSeb commented 2 years ago

ok, because I don't see what's is happening, you need to use BOX86_LOG=1 BOX86_TRACE_FILE=$(pwd)/trace-%pid.txt BOX64_LOG=1 BOX64_TRACE_FILE=$(pwd)/trace-%pid.txt to launch your program. It will generate 1 trace file per process, so things will not get mixed up!

ptitSeb commented 2 years ago

Or maybe use LOG=2, to get even more details

olevenets2 commented 2 years ago

ok i hope this helps

https://www.sendspace.com/file/6tyx8y https://www.sendspace.com/file/e6swgp

olevenets2 commented 2 years ago

Did these logs help? Did you manage to fix the issue?

ptitSeb commented 2 years ago

The only thing I see is the missing libunwind.so.8. You need to put x86_64 version of that lib in a place where box64 can find it.

It's not the first time I see this lib needed, I'll probably have to do somethng about it later.

olevenets2 commented 2 years ago

It works, thanks! It's not bad to add this somehow to box64 itself so as not to clutter the system with libraries from x86

25hawkeye commented 1 year ago

NOTE I don't know if you figured this out yet, but i noticed you were running the 32bit version of wine, and attempting to create a 64 bit prefix on BOX86. While the command wine will default to 32 bit prefixes unless specified, box determines it x86 due to how the 32-bit wine command is programmed. But when you try to make a 64 bit prefix, box86 already started instead of box64 for 64 bit programs due to how wine is 32-bit normally and then runs 64 libraries (this is my understanding of wine).

SOLUTION:

Instead of running the 32-bit wine command for running a 64-bit prefix (due to running 64bit AFTER 32bit started up), instead run the wine64 command and it will automatically start in 64 and box will recognize that its main library's are 64 bit.

rajdakin commented 2 months ago

Is this fixed now?