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
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?
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
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
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
This worked for me too! Great spot! (although slightly frustrated I didn’t spot this myself ).
When building with Visual Studio for Mac, environment variables set in ~/.zprofile or ~/.profile are not read.
I have successfully built with Visual Studio for Mac by setting the MGFXC_WINE_PATH environment variable at MacOS login using the following method.
create .plist file
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “https://www.apple.com/DTDs/PropertyList-1.0.dtd”>
launchctl setenv MGFXC_WINE_PATH "$HOME/.winemonogame"
Once you have created the file, please logout or restart macOS.
thank you all I did not understand the suggestions
it works now
This works on Debian 11, too.
compiled GeonBit.UI examples.
THANKS! this is what it finally took to get it running on Ubuntu for me
Hey, super helpful page, thanks!
I’m having trouble getting it to work though. It appears that all the steps go through, but when I actually go to compile shaders (after the Setup Wine step), I get
mgfxc: command not found
I noticed that the actual shader compilation is not in the script. Is it in a build action for you?
Looks like the issue was fixed in develop. Here is my current working script: