[MG3.8] mgfxc crashes on linux with System.BadImageFormatException

Hello,

compiling any effect using mgfxc leads to a crash with the below message.

Any idea is welcome!

Cheers

> mgfxc DeferredLightEffect.fx DeferredLightEffect.fx.out /Profile:OpenGL
Unhandled exception. System.BadImageFormatException: Could not load file or assembly 'Z:\home\spaaam\.dotnet\tools\.store\dotnet-mgfxc\3.8.0.1641\dotnet-mgfxc\3.8.0.1641\tools\netcoreapp3.1\any\mgfxc.dll'. Format of the executable (.exe) or library (.dll) is invalid.
File name: 'Z:\home\spaaam\.dotnet\tools\.store\dotnet-mgfxc\3.8.0.1641\dotnet-mgfxc\3.8.0.1641\tools\netcoreapp3.1\any\mgfxc.dll'


wine: Unhandled exception 0xe0434352 in thread 2c at address 0x7b44c1e7 (thread 002c), starting debugger...
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
Unhandled exception: 0xe0434352 in 64-bit code (0x000000007b44c1e7).
0037:fixme:dbghelp:elf_search_auxv can't find symbol in module
Register dump:
 rip:000000007b44c1e7 rsp:00000000002bee30 rbp:00000000002befa0 eflags:00000206 (   - --  I   - -P- )
 rax:00000000002bee50 rbx:00000000e0434352 rcx:00000000002bee50 rdx:00000000002bee70
 rsi:00000000002bf0a0 rdi:00000000002bee98  r8:0000000000000005  r9:00000000002bf078 r10:0000000000000006
 r11:00000000002bf078 r12:000000000001c928 r13:0000000000070060 r14:0000000000000001 r15:00000000002bf078
Stack dump:
0x00000000002bee30:  00000000002bee50 6465727265666544
0x00000000002bee40:  72735c65646f4365 6e656b61724b5c63
0x00000000002bee50:  00000001e0434352 0000000000000000
0x00000000002bee60:  000000007b44c1e7 0000000000000005
0x00000000002bee70:  ffffffff800700c1 0000000000000000
0x00000000002bee80:  0000000000000000 0000000000000000
0x00000000002bee90:  0000000000470000 0000000000000000
0x00000000002beea0:  00000000009f1388 000000000051f6f1
0x00000000002beeb0:  0000000000e69b00 00000000002bf320
0x00000000002beec0:  0000000000000000 0000000000000000
0x00000000002beed0:  0000000000079f30 000000000057be7e
0x00000000002beee0:  0000000000e69b00 7155f6c926633e00
Backtrace:
=>0 0x000000007b44c1e7 in kernel32 (+0x2c1e7) (0x00000000002befa0)
  1 0x000000000057bd48 in coreclr (+0x10bd47) (0x00000000002bf320)
  2 0x00000000006aac82 in coreclr (+0x23ac81) (0x00000000002bf320)
  3 0x0000000000637e54 in coreclr (+0x1c7e53) (0x00000000002bf320)
  4 0x00000000004721c1 in coreclr (+0x21c0) (0x00000000002bf320)
  5 0x00000000003d4e2d in hostpolicy (+0x4e2c) (0x00000000002bf4a0)
  6 0x00000000003e2e27 in hostpolicy (+0x12e26) (0x00000000002bf4a0)
  7 0x00000000003e2a36 in hostpolicy (+0x12a35) (0x00000000002bf789)
  8 0x00000000003e4262 in hostpolicy (+0x14261) (0x00000000002bf789)
  9 0x0000000180020653 in hostfxr (+0x20652) (0x00000000002bf789)
  10 0x00000001800237c8 in hostfxr (+0x237c7) (0x00000000002bf8b1)
  11 0x00000001800227cd in hostfxr (+0x227cc) (0x00000000002bfb40)
  12 0x000000018002027c in hostfxr (+0x2027b) (0x00000000002bfa90)
  13 0x000000018001bd0c in hostfxr (+0x1bd0b) (0x0000000000000006)
  14 0x000000014000d172 in dotnet (+0xd171) (0x00000000002bfce0)
  15 0x000000014000d4d3 in dotnet (+0xd4d2) (0x0000000000000006)
  16 0x000000014000f2d8 in dotnet (+0xf2d7) (0x00000000002bffd0)
  17 0x000000007b47a41a in kernel32 (+0x5a419) (0x00000000002bffd0)
0x000000007b44c1e7: movq	0x00000000000000b8(%rsp),%rax
Modules:
Module	Address					Debug info	Name (85 modules)
PE	          3d0000-          462000	Export          hostpolicy
PE	          470000-          9db000	Export          coreclr
PE	        19860000-        199a2000	Deferred        clrjit
ELF	        7b400000-        7b80d000	Dwarf           kernel32<elf>
  \-PE	        7b420000-        7b80d000	\               kernel32
ELF	        7bc00000-        7bd16000	Deferred        ntdll<elf>
  \-PE	        7bc20000-        7bd16000	\               ntdll
ELF	        7c000000-        7c004000	Deferred        <wine-loader>
PE	       140000000-       140027000	Export          dotnet
PE	       180000000-       180094000	Export          hostfxr
PE	     6448a000000-     6448a91d000	Deferred        system.private.corelib
ELF	    7f27ed4fd000-    7f27ed711000	Deferred        api-ms-win-core-synch-l1-1-0<elf
PE	    7f27ed500000-    7f27ed711000	Deferred        api-ms-win-core-synch-l1-1-0
ELF	    7f27ed811000-    7f27eda19000	Deferred        libffi.so.6
ELF	    7f27eda19000-    7f27edc9a000	Deferred        libgmp.so.10
ELF	    7f27edc9a000-    7f27edece000	Deferred        libhogweed.so.4
ELF	    7f27edece000-    7f27ee104000	Deferred        libnettle.so.6
ELF	    7f27ee104000-    7f27ee317000	Deferred        libtasn1.so.6
ELF	    7f27ee317000-    7f27ee695000	Deferred        libunistring.so.2
ELF	    7f27ee695000-    7f27ee8b2000	Deferred        libidn2.so.0
ELF	    7f27ee8b2000-    7f27eebe1000	Deferred        libp11-kit.so.0
ELF	    7f27eebe1000-    7f27eef47000	Deferred        libgnutls.so.30
ELF	    7f27eef47000-    7f27ef16d000	Deferred        imm32<elf>
  \-PE	    7f27eef50000-    7f27ef16d000	\               imm32
ELF	    7f27ef16d000-    7f27ef39f000	Deferred        libexpat.so.1
ELF	    7f27ef39f000-    7f27ef5e4000	Deferred        libfontconfig.so.1
ELF	    7f27ef5e4000-    7f27ef801000	Deferred        libz.so.1
ELF	    7f27ef801000-    7f27efa33000	Deferred        libpng16.so.16
ELF	    7f27efa33000-    7f27efce7000	Deferred        libfreetype.so.6
ELF	    7f27efce7000-    7f27efefb000	Deferred        api-ms-win-crt-utility-l1-1-0<el
PE	    7f27efcf0000-    7f27efefb000	Deferred        api-ms-win-crt-utility-l1-1-0
ELF	    7f27efefb000-    7f27f0118000	Deferred        bcrypt<elf>
  \-PE	    7f27eff00000-    7f27f0118000	\               bcrypt
ELF	    7f27f0118000-    7f27f03a5000	Deferred        shlwapi<elf>
  \-PE	    7f27f0130000-    7f27f03a5000	\               shlwapi
ELF	    7f27f03a5000-    7f27f0723000	Deferred        oleaut32<elf>
  \-PE	    7f27f03d0000-    7f27f0723000	\               oleaut32
ELF	    7f27f0723000-    7f27f09b8000	Deferred        rpcrt4<elf>
  \-PE	    7f27f0730000-    7f27f09b8000	\               rpcrt4
ELF	    7f27f09b8000-    7f27f0bd2000	Deferred        version<elf>
  \-PE	    7f27f09c0000-    7f27f0bd2000	\               version
ELF	    7f27f0bd2000-    7f27f0f4d000	Deferred        gdi32<elf>
  \-PE	    7f27f0bf0000-    7f27f0f4d000	\               gdi32
ELF	    7f27f0f4d000-    7f27f1389000	Deferred        user32<elf>
  \-PE	    7f27f0f70000-    7f27f1389000	\               user32
ELF	    7f27f1389000-    7f27f172a000	Deferred        ole32<elf>
  \-PE	    7f27f13b0000-    7f27f172a000	\               ole32
PE	    7f27f172a000-    7f27f193e000	Deferred        api-ms-win-crt-filesystem-l1-1-0
PE	    7f27f1730000-    7f27f193e000	Deferred        api-ms-win-crt-filesystem-l1-1-0C:\windows\system32\api-ms-win-crt-filesystem-l1-1-0.dll
ELF	    7f27f193e000-    7f27f1bce000	Deferred        advapi32<elf>
  \-PE	    7f27f1950000-    7f27f1bce000	\               advapi32
ELF	    7f27f1bce000-    7f27f1de1000	Deferred        api-ms-win-core-fibers-l1-1-1<el
PE	    7f27f1bd0000-    7f27f1de1000	Deferred        api-ms-win-core-fibers-l1-1-1
ELF	    7f27f1de1000-    7f27f1ff5000	Deferred        api-ms-win-core-synch-l1-2-0<elf
PE	    7f27f1df0000-    7f27f1ff5000	Deferred        api-ms-win-core-synch-l1-2-0
ELF	    7f27f1ff5000-    7f27f221f000	Deferred        libtinfo.so.5
ELF	    7f27f221f000-    7f27f2442000	Deferred        libncurses.so.5
ELF	    7f27f2442000-    7f27f2656000	Deferred        api-ms-win-crt-time-l1-1-0<elf>
  \-PE	    7f27f2450000-    7f27f2656000	\               api-ms-win-crt-time-l1-1-0
ELF	    7f27f2656000-    7f27f286b000	Deferred        api-ms-win-crt-convert-l1-1-0<el
PE	    7f27f2660000-    7f27f286b000	Deferred        api-ms-win-crt-convert-l1-1-0
ELF	    7f27f286b000-    7f27f2a7e000	Deferred        api-ms-win-crt-locale-l1-1-0<elf
PE	    7f27f2870000-    7f27f2a7e000	Deferred        api-ms-win-crt-locale-l1-1-0
ELF	    7f27f2a7e000-    7f27f2c94000	Deferred        api-ms-win-crt-string-l1-1-0<elf
PE	    7f27f2a80000-    7f27f2c94000	Deferred        api-ms-win-crt-string-l1-1-0
ELF	    7f27f2c94000-    7f27f2ea9000	Deferred        api-ms-win-crt-stdio-l1-1-0<elf>
  \-PE	    7f27f2ca0000-    7f27f2ea9000	\               api-ms-win-crt-stdio-l1-1-0
ELF	    7f27f2ea9000-    7f27f30c2000	Deferred        api-ms-win-crt-math-l1-1-0<elf>
  \-PE	    7f27f2eb0000-    7f27f30c2000	\               api-ms-win-crt-math-l1-1-0
ELF	    7f27f30c2000-    7f27f32d6000	Deferred        api-ms-win-crt-heap-l1-1-0<elf>
  \-PE	    7f27f30d0000-    7f27f32d6000	\               api-ms-win-crt-heap-l1-1-0
ELF	    7f27f32d6000-    7f27f35ea000	Deferred        ucrtbase<elf>
  \-PE	    7f27f3300000-    7f27f35ea000	\               ucrtbase
ELF	    7f27f36ea000-    7f27f38ff000	Deferred        api-ms-win-crt-runtime-l1-1-0<el
PE	    7f27f36f0000-    7f27f38ff000	Deferred        api-ms-win-crt-runtime-l1-1-0
ELF	    7f27f3e12000-    7f27f4024000	Deferred        libnss_files.so.2
ELF	    7f27f4024000-    7f27f423e000	Deferred        libnsl.so.1
ELF	    7f27f423e000-    7f27f444a000	Deferred        libnss_nis.so.2
ELF	    7f27f444a000-    7f27f4654000	Deferred        libnss_compat.so.2
ELF	    7f27f4754000-    7f27f496c000	Deferred        libgcc_s.so.1
ELF	    7f27f496c000-    7f27f4d0a000	Deferred        libm.so.6
ELF	    7f27f4d0a000-    7f27f4f0e000	Deferred        libdl.so.2
ELF	    7f27f4f0e000-    7f27f52ff000	Deferred        libc.so.6
ELF	    7f27f52ff000-    7f27f551e000	Deferred        libpthread.so.0
ELF	    7f27f58c3000-    7f27f5aed000	Deferred        ld-linux-x86-64.so.2
Threads:
process  tid      prio (all id:s are in hex)
0000000e services.exe
	00000022    0
	0000001d    0
	00000015    0
	00000014    0
	00000013    0
	00000010    0
	0000000f    0
00000011 winedevice.exe
	0000001c    0
	00000019    0
	00000018    0
	00000017    0
	00000016    0
	00000012    0
0000001a plugplay.exe
	0000001f    0
	0000001e    0
	0000001b    0
00000020 winedevice.exe
	0000002d    0
	00000026    0
	00000025    0
	00000024    0
	00000023    0
	00000021    0
00000027 explorer.exe
	00000030    0
	0000002f    0
	0000002e    0
	00000028    0
0000002b (D) C:\windows\system32\dotnet.exe
	00000034    0
	00000033    0
	00000032    2
	00000031    0
	0000002c    0 <==
System information:
    Wine build: wine-3.0 (Ubuntu 3.0-1ubuntu1)
    Platform: x86_64
    Version: Windows 7
    Host system: Linux
    Host version: 4.15.0-1093-oem

The wine prefix is using 32 bit wine. Not sure how that happened.

Okay, thanks for the hint.

I removed 32 bit wine from my system, uninstalled and reinstalled mgfxc (using dotnet tool uninstall -g dotnet-mgfxc then dotnet tool install -g dotnet-mgfxc), but the problem persists. :thinking:

You need to delete your mg wine prefix and recreate it with the script.

Thanks for your answer. I just deleted my .winemonogame in /home/spaaam, ran mgfxc_wine_setup.sh, then dotnet tool install -g dotnet-mgfxc, but I still got the exact same error.

Yea, I am not able to repro it.

What Linux distro are you using?

I am running Ubuntu 18.04.5 LTS, and migrated from MG 3.7 nuget packages.

Have you updated your wine? Ubuntu 18.04 has outdated wine iirc.

Well spotted! I had wine 3.0, updated it to 5.0, and now it works. Thanks a lot!