Frogging-Family / wine-tkg-git

The wine-tkg build systems, to create custom Wine and Proton builds
861 stars 156 forks source link

[Wine-Staging-tkg] Recent 8.1x Versions Seem to Throw Unhandled Exceptions #1053

Open ThisNekoGuy opened 1 year ago

ThisNekoGuy commented 1 year ago

For some reason, recent Wine-Staging versions have been throwing error pop-ups just by opening winecfg (notably iexplorer.exe) and winetricks (cmd.exe). I'm not sure if this behavior extends to other applications Wine attempts to run but, given this strange behavior not occurring with my vanilla plain Wine from the repos, I find it odd and I don't understand why :/

(The last version I haven't found to do this is 8.9.1)

Build Flags from wine-tkg.cfg: ```bash # Custom GCC flags to use instead of system-wide makepkg flags set in /etc/makepkg.conf. Default is "-pipe -O2 -ftree-vectorize". Don't use -march=native if you want to share your builds accross different machines! _GCC_FLAGS="-O2 -pipe -ftree-vectorize -march=znver2 -mtune=znver2 -fexceptions -Wformat -Werror=format-security" # Custom LD flags to use instead of system-wide makepkg flags set in /etc/makepkg.conf. Default is "-pipe -O2 -ftree-vectorize". _LD_FLAGS="-pipe -Wl,-O2,--sort-common,--as-needed" # Same as _GCC_FLAGS but for cross-compiled binaries. _CROSS_FLAGS="-O2 -pipe -ftree-vectorize -march=znver2 -mtune=znver2 -fexceptions -Wformat -Werror=format-security" # Same as _LD_FLAGS but for cross-compiled binaries. _CROSS_LD_FLAGS="-pipe -Wl,-O2,--sort-common,--as-needed" ```

prepare.log

Screenshot example: ![Screenshot_20230814_234105](https://github.com/Frogging-Family/wine-tkg-git/assets/28468662/8ce9ee53-8864-40be-9ded-ec5065137200)
Pop-up Details: ```log Unhandled exception: page fault on read access to 0xffffffff in wow64 32-bit code (0x7e478f2d). Register dump: CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b EIP:7e478f2d ESP:0070b258 EBP:0070b310 EFLAGS:00010202( R- -- I - - - ) EAX:0000003d EBX:0070b382 ECX:0042259a EDX:00000020 ESI:0042259a EDI:0070b382 Stack dump: 0x0070b258: 00000003 7e4b45d0 7e4c1ba8 7e4c1948 0x0070b268: 0070b382 00000400 7ffc334c 00000000 0x0070b278: 0070bf40 00000000 0070b382 7b01ca8b 0x0070b288: 00350000 00000000 0035b0d0 00000800 0x0070b298: 0070b6e8 00000000 003f0000 000037c8 0x0070b2a8: 0070b330 00000400 0070b2d0 00000400 Backtrace: =>0 0x7e478f2d in user32 (+0x68f2d) (0x0070b310) 1 0x7e479ab4 in user32 (+0x69ab4) (0x0070b320) 2 0x0041c500 in cmd (+0x1c500) (0x0070ff00) 3 0x0041daf3 in cmd (+0x1daf3) (0x0070ff30) 4 0x7b82a810 in kernel32 (+0x2a810) (0x0070ff48) 5 0x7bc5def7 in ntdll (+0x5def7) (0x0070ff5c) 6 0x7bc5e728 in ntdll (+0x5e728) (0x0070ffec) 0x7e478f2d user32+0x68f2d: vmovdqa %xmm4, -0x88(%ebp) Modules: Module Address Debug info Name (52 modules) PE 00400000-00502000 Dwarf cmd PE 64a80000-64aa8000 Deferred win32u PE 65680000-6572a000 Deferred msvcrt PE 66080000-660c7000 Deferred shlwapi PE 66640000-6664c000 Deferred version PE 667c0000-667d6000 Deferred shcore PE 67500000-6751d000 Deferred imm32 PE 67bc0000-67d17000 Deferred comctl32 PE 69840000-69880000 Deferred advapi32 PE 6aac0000-6ab90000 Deferred ucrtbase PE 6afc0000-6afd0000 Deferred aclui PE 6bb40000-6bb58000 Deferred winex11 PE 6bbc0000-6bbe7000 Deferred sechost PE 6da80000-6db07000 Deferred gdi32 PE 70d80000-70db7000 Deferred uxtheme PE 71400000-71d4c000 Deferred shell32 PE 7b000000-7b297000 Deferred kernelbase PE 7b800000-7b85e000 Dwarf kernel32 PE 7bc00000-7bcaa000 Dwarf ntdll ELF 7de4f000-7de5c000 Deferred libxcursor.so.1 ELF 7df5c000-7df71000 Deferred libxi.so.6 ELF 7df71000-7df79000 Deferred libxfixes.so.3 ELF 7df79000-7df89000 Deferred libxrandr.so.2 ELF 7df89000-7dfb5000 Deferred libxcb.so.1 ELF 7dfb5000-7e107000 Deferred libx11.so.6 ELF 7e107000-7e11d000 Deferred libxext.so.6 ELF 7e16d000-7e1fb000 Deferred winex11.so ELF 7e2ce000-7e2f9000 Deferred libexpat.so.1 ELF 7e2f9000-7e34c000 Deferred libfontconfig.so.1 ELF 7e34c000-7e3ed000 Deferred libpcre2-8.so.0 ELF 7e3ed000-7e410000 Deferred libbrotlicommon.so.1 PE 7e410000-7e5d5000 Dwarf user32 ELF 7e5d8000-7e5e6000 Deferred libxrender.so.1 ELF 7e5e6000-7e74b000 Deferred libglib-2.0.so.0 ELF 7e74b000-7e869000 Deferred libharfbuzz.so.0 ELF 7e869000-7e8a6000 Deferred libpng16.so.16 ELF 7e8a6000-7e8b8000 Deferred libbz2.so.1.0 ELF 7e8b8000-7e986000 Deferred libfreetype.so.6 ELF 7ee00000-7ee05000 Deferred libxcomposite.so.1 ELF 7ee05000-7ee0d000 Deferred libxxf86vm.so.1 ELF 7ee0d000-7ee26000 Deferred libz.so.1 ELF 7ee29000-7ee2e000 Deferred libxinerama.so.1 ELF 7ee2e000-7ee35000 Deferred libxdmcp.so.6 ELF 7ee35000-7ee3a000 Deferred libxau.so.6 ELF 7ee76000-7f000000 Deferred win32u.so ELF f7a21000-f7a4a000 Deferred libgcc_s.so.1 ELF f7a4a000-f7b1e000 Deferred libm.so.6 ELF f7b1e000-f7c00000 Dwarf ntdll.so ELF f7c00000-f7e4f000 Deferred libc.so.6 ELF f7e90000-f7e9e000 Deferred libbrotlidec.so.1 ELF f7fa1000-f7fd6000 Deferred ld-linux.so.2 ELF f7fd6000-f7fdb000 Deferred Threads: process tid prio name (all IDs are in hex) 00000020 start.exe ["C:\windows\syswow64\start.exe" /exec cmd /c "echo init"] 00000024 0 00000038 services.exe 0000003c 0 00000040 0 wine_rpcrt4_server 0000004c 0 wine_rpcrt4_io 0000005c 0 wine_rpcrt4_io 00000078 0 wine_rpcrt4_io 00000084 0 wine_rpcrt4_io 000000b4 0 wine_rpcrt4_io 000000cc 0 wine_rpcrt4_io 000000dc 0 000000f4 0 wine_rpcrt4_io 00000044 winedevice.exe 00000048 0 00000054 0 00000058 0 wine_sechost_service 00000060 0 00000064 0 00000068 0 0000006c 0 000000d8 0 00000070 winedevice.exe 00000074 0 0000007c 0 00000080 0 wine_sechost_service 00000088 0 0000008c 0 00000090 0 0000009c 0 000000a0 0 000000ac 0 000000b0 0 00000094 explorer.exe 00000098 0 000000e0 0 000000e4 0 wine_rpcrt4_server 000000a4 plugplay.exe 000000a8 0 000000b8 0 000000bc 0 wine_sechost_service 000000c0 0 wine_rpcrt4_server 000000c4 svchost.exe 000000c8 0 000000d0 0 000000d4 0 wine_sechost_service 000000ec rpcss.exe 000000f0 0 000000fc 0 00000100 0 wine_sechost_service 00000104 0 wine_rpcrt4_server 00000108 0 wine_rpcrt4_server 0000010c 0 wine_rpcrt4_io 00000140 0 wine_rpcrt4_io 00000114 conhost.exe 00000118 0 0000011c (D) C:\windows\syswow64\cmd.exe ["C:\windows\system32\cmd.exe" /c "echo init"] 00000120 0 <== 0000012c 0 00000130 explorer.exe 00000134 0 00000138 0 0000013c 0 wine_rpcrt4_server System information: Wine build: wine-8.13.r0.g1942fb8b ( TkG Staging Esync Fsync ) Platform: x86_64 (guest: i386) Version: Windows 10 Host system: Linux Host version: 6.4.9-273-tkg-pds ```
llde commented 1 year ago

try compiling without architecture specific optimization (march and mtune options), it stopped this behaviour for me

ThisNekoGuy commented 1 year ago

While that is good to know, it's not ideal... and I'd wager that might make the issue a compiler bug? (not sure)

diomhaireachd commented 1 year ago

If the issue is with the 32bit side of wine its probably avx instructions I've got -mno-avx -mno-avx2 in the _CROSS_FLAGS in advanced-customization.cfg

Saancreed commented 1 year ago

There should be no need to disable AVX2, just -mincoming-stack-boundary=2 should be enough to fix this (or -muse-unaligned-vector-move but in theory the former is more correct).

And if I were to guess, it's probably caused by https://gitlab.winehq.org/wine/wine/-/commit/62173699c38453777c7d5638ed2e779790506b75

ThisNekoGuy commented 1 year ago

Using -mincoming-stack-boundary=2 immediately throws an error:

checking whether the C compiler works... no
configure: error: in `/home/neko-san/wine-tkg-git/wine-tkg-git/src/wine-tkg-staging-fsync-git-64-build':
configure: error: C compiler cannot create executables
Saancreed commented 1 year ago

Well, not for 64-bit builds of course :smile:

Try this:

diff --git a/wine-tkg-git/wine-tkg-scripts/build.sh b/wine-tkg-git/wine-tkg-scripts/build.sh
index 664512ab..298071c7 100644
--- a/wine-tkg-git/wine-tkg-scripts/build.sh
+++ b/wine-tkg-git/wine-tkg-scripts/build.sh
@@ -128,6 +128,7 @@ _build_serial() {
   if [ "$_NOLIB32" != "true" ] && [ "$_NOLIB32" != "wow64" ]; then
     # build wine 32-bit
     # nomakepkg
+    export CROSSCFLAGS+=' -mincoming-stack-boundary=2'
     if [ "$_nomakepkg_midbuild_prompt" = "true" ]; then
       msg2 '64-bit side has been built, 32-bit will follow.'
       msg2 'This is the time to install the 32-bit devel packages you might need.'
ThisNekoGuy commented 1 year ago

@Saancreed This seems to work, yeah Hopefully this won't be needed forever, though

loathingKernel commented 6 months ago

I know this is somewhat old, but you might also have luck with using -mtune=generic instead without any need to change -march