MGFXC 8.3.1 / Wine

Hey Folks,

Since 8.3.1 I have had no luck getting MGFXC to work with Wine on MacOS (x64).

The steps I’m taking:
Install .NET 6 SDK & Runtimes
Install MGFXC Dotnet tool
Install Wine64 & update to 6.0
Run mgfxc_wine_setup.sh helper script

mgfxc test.fx test.fx.out /Profile:OpenGL

Compilation has never succeeded but have seen it fail in various different ways:
Exits silently, doesn’t compile (most common)
Wine fails to find c:/windows/system32/dotnet.exe (it’s there, I’ve checked!)

I believe this approach worked well using 8.3 (but shaders compiled on 8.3 are not compatible with 8.3.1).

I’ve also failed with similar results on Ubuntu x64 and ARM64. The only success I’ve had was from using Windows (Bootcamped on Mac x64), which suggests the issue lies in compatibility with Wine.

Has anyone had any luck using 8.3.1 version MGFXC with Wine?

Thanks!

I had same problem under ubuntu…

I spent about 6 hours trying to fix this under Ubuntu and and couldn’t get it to work (I was pretty frustrated by the end, as you might imagine). I’m using a virtual machine to build my shaders now :frowning:

It seems to be some kind of issue with wine trying to run dotnet as a 32-bit application instead of a 64-bit one for some reason I couldn’t decipher. It fails to find c:/windows/system32/dotnet.exe because it’s actually looking for c:/windows/syswow64/dotnet.exe. Even once I got the 64-bit dotnet executable to run by installing it somewhere else it would still think it’s in 32-bit mode, so MGFXC just instantly crashed anyways.

Don’t know if this helps but I have this pipeline that works with Ubuntu:

Even copy and pasting those exact commands my shaders still wont build. I have no idea how to debug this because it seems to be something external to monogame, and even messing with WineHelper.cs in MonoGame.Effect.Compiler I couldn’t make any progress.
I updated to Ubuntu 22.04 at the same time I updated to monogame 3.8.1, maybe it’s an issue with specific wine versions?

I experimented with Wine versions 5.0, 6.0 and 7.0 in various different environments, the specific errors varied slightly but still no success.

I think I figured it out! Not sure why I didn’t check this earlier but for some reason the mgfxc_wine_setup.sh downloads the 32-bit version of dotnet than puts it in the 64-bit system32! Let me know if this works for you; delete ~/.winemonogame then replace line 32 of mgfxc_wine_setup.sh with

DOTNET_URL="https://download.visualstudio.microsoft.com/download/pr/44d08222-aaa9-4d35-b24b-d0db03432ab7/52a4eb5922afd19e8e0d03e0dbbb41a0/dotnet-sdk-6.0.302-win-x64.zip"

Then run run the script and your shaders should now build. I’ve created an issues and pr on github here `mgfxc_wine_setup.sh` downloads the x86 dotnet exectuable instead of the x64 exectuable · Issue #7898 · MonoGame/MonoGame · GitHub

3 Likes

This worked for me too! Great spot! (although slightly frustrated I didn’t spot this myself :wink:).