AndreRH / hangover

Hangover runs simple Win32 applications on arm64 Linux
GNU Lesser General Public License v2.1
1.24k stars 91 forks source link

[aarch64-musl] ws2_32.dll failed to initialize // could not load kernel32.dll #141

Closed bareich closed 2 months ago

bareich commented 6 months ago

Realizing that this is the more appropriate place to post the information, I'm moving this over from the WineHQ forum:

I compiled llvm-mingw from source (no musl binaries for download) and then Hangover as explained in the README.

Any exe I try to run with wine causes errors about ws2_32.dll and kernel32.dll:

/hangover/wine/build% find ./ -name kernel32.dll -o -name ws2_32.dll
./dlls/kernel32/aarch64-windows/kernel32.dll
./dlls/kernel32/i386-windows/kernel32.dll
./dlls/ws2_32/aarch64-windows/ws2_32.dll
./dlls/ws2_32/i386-windows/ws2_32.dll

/hangover/wine/build% ./wine programs/winecfg/aarch64-windows/winecfg.exe
002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
002c:err:module:loader_init "ws2_32.dll" failed to initialize, aborting
002c:err:module:loader_init Initializing dlls for L"C:\\windows\\system32\\wineboot.exe" failed, status c0000142
wine: could not load kernel32.dll, status c0000135

/hangover/wine/build% ./wine programs/winecfg/i386-windows/winecfg.exe
002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
002c:err:module:loader_init "ws2_32.dll" failed to initialize, aborting
002c:err:module:loader_init Initializing dlls for L"C:\\windows\\system32\\wineboot.exe" failed, status c0000142
0024:err:environ:init_peb starting L"Z:\\hangover\\wine\\build\\programs\\winecfg\\i386-windows\\winecfg.exe" in experimental wow64 mode
wine: could not load kernel32.dll, status c0000135

Any ideas?

(Note that this doesn't necessarily have to do with musl, but I figured I'd point it out for good measure.)

AndreRH commented 6 months ago

That should not happen. What you can try to narrow down the issue is:

bareich commented 6 months ago

The Hangover version I built with this configuration:

../configure --disable-tests --with-mingw --enable-archs=i386,aarch64

Shall I use the same options (and MinGW in $PATH) for the vanilla build?

AndreRH commented 6 months ago

Yes exactly

bareich commented 6 months ago

With vanilla wine, the error for aarch64-windows/winecfg.exe is exactly as above.

The error with i386-windows/winecfg.exe differs slightly:

/wine/build/wine programs/winecfg/i386-windows/winecfg.exe
002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
002c:err:module:loader_init "ws2_32.dll" failed to initialize, aborting
002c:err:module:loader_init Initializing dlls for L"C:\\windows\\system32\\wineboot.exe" failed, status c0000142
0024:err:environ:init_peb starting L"Z:\\wine\\build\\programs\\winecfg\\i386-windows\\winecfg.exe" in experimental wow64 mode
0024:err:module:init_wow64 could not load L"C:\\windows\\system32\\wow64.dll", status c0000135

For glibc I will have to create a chroot and report back.

AndreRH commented 6 months ago

Then it's likely a wine on musl issue, that's something for upstream wine

bareich commented 6 months ago

In Debian (glibc) chroot, downloaded MinGW binaries, vanilla WINE build I get new problems:

file ./dlls/ntdll/ntdll.so
./dlls/ntdll/ntdll.so: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=4458a8aa4d36906d6783c1ea465767ba230cb227, with debug_info, not stripped

/debian/wine/build/wine programs/winecfg/i386-windows/winecfg.exe
wine: could not load ntdll.so: (null)

/debian/wine/build/wine programs/winecfg/i386-windows/winecfg.exe
wine: could not load ntdll.so: (null)

rm -Rf ~/.wine ; WINEPREFIX=~/.wine WINEARCH="win32" WINEDLLPATH=./dlls/ntdll  ./wine programs/winecfg/i386-windows/winecfg.exe
wine: created the configuration directory '/root/.wine'
wineserver: failed to load l_intl.nls
wine client error:0: recvmsg: Connection reset by peer

WINEPREFIX=~/.wine WINEARCH="win32" WINEDLLPATH=./dlls/ntdll  ./wine programs/winecfg/aarch64-windows/winecfg.exe
wineserver: failed to load l_intl.nls
wine client error:0: recvmsg: Connection reset by peer

Is there anything in my (previous) findings that points to a likely cause for my issue?

Regarding configure: Why am I adding aarch64 to --enable-archs - shouldn't i386 suffice?

AndreRH commented 6 months ago

Regarding configure: Why am I adding aarch64 to --enable-archs - shouldn't i386 suffice? For a vanilla build, aarch64 is enough, as vanilla Wine can't run i386 on aarch64 yet (that's what Hangover is for)

/debian/wine/build/wine programs/winecfg/i386-windows/winecfg.exe As I said, that won't work.

rm -Rf ~/.wine ; WINEPREFIX=~/.wine WINEARCH="win32" WINEDLLPATH=./dlls/ntdll ./wine programs/winecfg/i386-windows/winecfg.exe

You're setting the default WINEPREFIX, not needed. Your're setting WINEARCH to win32, which is wrong. It'll be a aarch64 prefix, thus win64. But you also don't need to set it. I would also recommend not to mess with WINEDLLPATH.

So still, this is very odd. did you get a "Wine build complete." after running make?

bareich commented 6 months ago

Yes. I just started fresh (rm -Rf wine/build) up to Wine build complete..

The env vars was just to try variants for new errors. I usually start without any. HODLL doesn't make any difference either, which leads me to think that it doesn't get to any emulation stage in the first place.

AndreRH commented 6 months ago

I haven't heard of others with such issues, so something in your chroot is likely wrong, but I can't tell what from here. Did you report the musl issue upstream?

bareich commented 6 months ago

Upstream it's bug #55862.

To avoid confusing (myself and others :)) once again the different results (both on aarch64 musl host):

vanilla (aarch64 binary)

cd /wine/build ; rm -Rf ~/.wine ; sleep 1 ; ./wine programs/powershell/aarch64-windows/powershell.exe
wine: created the configuration directory '/home/user/.wine'
002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
002c:err:module:loader_init "ws2_32.dll" failed to initialize, aborting
002c:err:module:loader_init Initializing dlls for L"C:\\windows\\system32\\wineboot.exe" failed, status c0000142
wine: could not load kernel32.dll, status c0000135

hangover (i386 binary)

cd /hangover/wine/build ; rm -Rf ~/.wine ; sleep 1 ; ./wine programs/powershell/i386-windows/powershell.exe
wine: created the configuration directory '/home/user/.wine'
002c:fixme:actctx:parse_depend_manifests Could not find dependent assembly L"Microsoft.Windows.Common-Controls" (6.0.0.0)
002c:err:module:loader_init "ws2_32.dll" failed to initialize, aborting
002c:err:module:loader_init Initializing dlls for L"C:\\windows\\system32\\wineboot.exe" failed, status c0000142
0024:err:environ:init_peb starting L"Z:\\hangover\\wine\\build\\programs\\powershell\\i386-windows\\powershell.exe" in experimental wow64 mode
wine: could not load kernel32.dll, status c0000135
AndreRH commented 2 months ago

closing Wine issue, see https://bugs.winehq.org/show_bug.cgi?id=55862#c6