Cannot launch the game

Using Monogame 3.8.1.2155-develop.

Launching the game always fails with the Failed to load library: libSDL2-2.0.0.dylib error which seems to come from not finding the dylib file. In a fit of desperation I’ve copied the lib at every single searched location and it still fails. It’s been a week and I’ve ran out of ideas.

Terra v0.1
        Platform:       Unix 12.3.1 64-bit (via DesktopGL)
        Process:        /usr/local/share/dotnet/dotnet (12056) 64-bit
        Graphics:       OpenGL

        Directory:      /Users/lancelot/Developer/Game/Terra/Client/bin/Debug/net6.0
        Assemblies:     /Users/lancelot/Developer/Game/Terra/Client/bin/Debug/net6.0

System.TypeInitializationException: The type initializer for 'Sdl' threw an exception.
 ---> System.Exception: Failed to load library: libSDL2-2.0.0.dylib
   at MonoGame.Framework.Utilities.FuncLoader.LoadLibraryExt(String libname)
   at Sdl..cctor()
   --- End of inner exception stack trace ---
   at Microsoft.Xna.Framework.SdlGamePlatform..ctor(Game game)
   at Microsoft.Xna.Framework.Game..ctor()
   at Terra.TerraGame..ctor() in /Users/lancelot/Developer/Game/Terra/Client/Terra.cs:line 22
   at Terra.Program.Main() in /Users/lancelot/Developer/Game/Terra/Client/Program.cs:line 29

I can’t verify what version 3.8.1.2155-develop exactly is, but it would seem that it’s an outdated teamcity build (which is lagging a few months from what happens on the repository, we’ll fix that for 3.8.1).

I would assume this to be because of SDL is lacking M1 binaries, which has been fixed in the repository.

It’s not yet documented on the website, but you can find the freshest development builds on Github now. You will have to locally host the nuget package, which we haven’t documented yet either. The documentation will come with 3.8.1 public release.

Alternatively, you may try to grab the SDL dylib with M1 support from here (be mindful of your older MG version needs to rename it).

If it’s about the M1 support, you will likely run into the same issue with OpenAL (the process is the same if you need an updated build, it’s all on github until 3.8.1 is released).

1 Like

Thanks a lot, I didn’t know about those packages! I am now using 3.8.1.210-develop by referring to a local nuget feed and the game runs! I didn’t have to build to modify the bundled SDL or OpenAL, so that version is all working on M1!

However, content cannot build. I made sure to install the ones from GitHub, so these are my dotnet tools…

╰─❯ dotnet tool list -g                                                                                               ╯
Package Id                  Version                Commands       
------------------------------------------------------------------
dotnet-mgcb                 3.8.1.210-develop      mgcb           
dotnet-mgcb-editor-mac      3.8.1.210-develop      mgcb-editor-mac
dotnet-mgfxc                3.8.1.210-develop      mgfxc 

…along with the project references

Project 'KyoobGame' has the following package references
   [net6.0]: 
   Top-level Package                    Requested           Resolved         
   > MonoGame.Content.Builder.Task      3.8.1.210-develop   3.8.1.210-develop
   > MonoGame.Framework.DesktopGL       3.8.1.210-develop   3.8.1.210-develop

Project 'KyoobLibrary' has the following package references
   [net6.0]: 
   Top-level Package                   Requested           Resolved         
   > LibNoise.NetStandart              0.2.0               0.2.0            
   > MonoGame.Framework.DesktopGL      3.8.1.210-develop   3.8.1.210-develop
   > Newtonsoft.Json                   13.0.1              13.0.1 

However when the content pipeline is involved the dotnet mgcb command fails. I tried it separately on the terminal and this was my result:

Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET program, but dotnet-mgcb does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.

Running the same command but without the dotnet prefix works (I added dotnet global tools to my PATH) but now fails with a whole bunch of new errors! (I haven’t had the time to setup the wine installation so I get that one, the other two I feel like they should work)

Build started 2022-06-01 8:10:27 PM

/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/Content/arial.spritefont
	Building Font /System/Library/Fonts/Supplemental/Arial.ttf
/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/Content/arial.spritefont: error: Processor 'FontDescriptionProcessor' had unexpected failure!
System.DllNotFoundException: Unable to load shared library 'freetype6' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libfreetype6, 0x0001): tried: 'libfreetype6' (no such file), '/usr/local/lib/libfreetype6' (no such file), '/usr/lib/libfreetype6' (no such file), '/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/libfreetype6' (no such file)
   at SharpFont.FT.FT_Init_FreeType(IntPtr& alibrary)
   at SharpFont.Library..ctor()
   at Microsoft.Xna.Framework.Content.Pipeline.Graphics.SharpFontImporter.Import(FontDescription options, String fontName) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Graphics/Font/SharpFontImporter.cs:line 29
   at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.ImportFont(FontDescription options, Single& lineSpacing, Int32& yOffsetMin, ContentProcessorContext context, String fontName) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Processors/FontDescriptionProcessor.cs:line 194
   at Microsoft.Xna.Framework.Content.Pipeline.Processors.FontDescriptionProcessor.Process(FontDescription input, ContentProcessorContext context) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Processors/FontDescriptionProcessor.cs:line 80
   at Microsoft.Xna.Framework.Content.Pipeline.ContentProcessor`2.Microsoft.Xna.Framework.Content.Pipeline.IContentProcessor.Process(Object input, ContentProcessorContext context) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/ContentProcessor.cs:line 60
   at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Builder/PipelineManager.cs:line 717
/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/Content/block_render.fx
/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/Content/block_render.fx: MGFXC effect compiler requires a valid Wine installation to be able to compile shaders.
Setup instructions:
- Create 64 bit wine prefix
- Install d3dcompiler_47 using winetricks
- Install .NET 6
- Setup MGFXC_WINE_PATH environmental variable to point to a valid wine prefix

/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/Content/spritesheet.png
/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/Content/spritesheet.png: error: Importer 'TextureImporter' had unexpected failure!
System.DllNotFoundException: Unable to load shared library 'FreeImage' or one of its dependencies. In order to help diagnose loading problems, consider setting the DYLD_PRINT_LIBRARIES environment variable: dlopen(libFreeImage, 0x0001): tried: 'libFreeImage' (no such file), '/usr/local/lib/libFreeImage' (no such file), '/usr/lib/libFreeImage' (no such file), '/Users/lancelot/Developer/Clone/kyoob/source/KyoobGame/libFreeImage' (no such file)
   at FreeImageAPI.FreeImage.GetFileTypeS(String filename, Int32 size)
   at FreeImageAPI.FreeImage.GetFileType(String filename, Int32 size) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Utilities/FreeImageAPI.cs:line 122
   at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import(String filename, ContentImporterContext context) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/TextureImporter.cs:line 83
   at Microsoft.Xna.Framework.Content.Pipeline.ContentImporter`1.Microsoft.Xna.Framework.Content.Pipeline.IContentImporter.Import(String filename, ContentImporterContext context) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/ContentImporter.cs:line 45
   at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) in /home/runner/work/MonoGame/MonoGame/MonoGame.Framework.Content.Pipeline/Builder/PipelineManager.cs:line 669

Build 0 succeeded, 3 failed.

Time elapsed 00:00:00.29.

Yeah, MGCB won’t work (natively) on Apple M1 for the time being. I explained why and how to workaround it here (it’s going to be documented in the 3.8.1 docs).

1 Like

Ah, thanks a lot!

Can I know when?

When 3.8.1 will be released, which will happen, anytime soon no specific ETA.