I tried to make a thread for this on the community forums, but no amount of finagling with the title got me through the title filter :frowning_face:
I'm trying to start up a barebones MonoGame project in JetBrains Rider, because MonoDevelop was giving me a headache. Just a really basic, "open a cornflower blue window" project to get started with. The code is lifted from https://gist.github.com/RetrocadeNet/51dfdaf5609285241a9f812c9b8ee06b, only the name of the game has changed.
Tutorials for working with MonoGame in Ubuntu are basically nonexistent, but I'm running Ubuntu 16.04 and have installed MonoGame.Framework.DesktopGL v3.6.0.1625 as well as MonoGame.Content.Builder v3.6.0.1 through NuGet.
But running just gives me this error. It seems the System.EntryPointNotFoundException is coming from the GraphicsDevice and is showing up in my debugger even before I call _graphics = new GraphicsDeviceManager(this).
Could it be an issue with my graphics card or driver? I've got a GTX 1060 and I'm running the nvidia 375.66 linux driver which should have OpenGL 4 support. So I'm a little puzzled.
Stack trace follows
Unhandled Exception:
Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device! ---> System.EntryPointNotFoundException: SDL_SetWindowResizable
at (wrapper managed-to-native) Sdl+Window:SetResizable (intptr,bool)
at Microsoft.Xna.Framework.SdlGameWindow.CreateWindow () [0x00098] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.PlatformInitialize (Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x000d8] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00023] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00011] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00036] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice () [0x00000] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00016] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at FirstMate.Program.Main () [0x00007] in <adcb49decfc74620a86dd74f00c4f305>:0
[ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Xna.Framework.Graphics.NoSuitableGraphicsDeviceException: Failed to create graphics device! ---> System.EntryPointNotFoundException: SDL_SetWindowResizable
at (wrapper managed-to-native) Sdl+Window:SetResizable (intptr,bool)
at Microsoft.Xna.Framework.SdlGameWindow.CreateWindow () [0x00098] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.PlatformInitialize (Microsoft.Xna.Framework.Graphics.PresentationParameters presentationParameters) [0x000d8] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Initialize () [0x00023] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00011] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
--- End of inner exception stack trace ---
at Microsoft.Xna.Framework.GraphicsDeviceManager.CreateDevice () [0x00036] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.GraphicsDeviceManager.Microsoft.Xna.Framework.IGraphicsDeviceManager.CreateDevice () [0x00000] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.DoInitialize () [0x00016] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run (Microsoft.Xna.Framework.GameRunBehavior runBehavior) [0x0002d] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at Microsoft.Xna.Framework.Game.Run () [0x0000c] in <c31673e23fbb4b338ace0c0a31a4b94e>:0
at FirstMate.Program.Main () [0x00007] in <adcb49decfc74620a86dd74f00c4f305>:0
That error is misleading. The failure happens when MG tries to create a window for your game using SDL. It looks like the SDL dll did not get included properly. @mdhausman Can you check if it is present in your bin folder? It should be included through the NuGet.
It definitely isn't in my bin folder. bin/Debug just has the game exe, a pdb, MonoGame.Framework.dll, and MonoGame.Framework.xml (which looks to be MonoGame documentation).
If I can't make this work I guess I can just develop on my Windows partition; it's up and running fine in Visual Studio. I just prefer to work in Linux.
If you install SDL on your machine it should resolve the dll. You may want to include the native dll when shipping though. There's also OpenAL that you're missing. You'll need it for playing sounds.
Alternatively, you can get these .dll's by installing MonoGame or by downloading them from the dependencies repo: https://github.com/MonoGame/MonoGame.Dependencies
I think the dependencies weren't in the NuGets before #5542, which was merged after the 3.6 release.
Is that right @cra0zy?
If you install SDL on your machine it should resolve the dll. You may want to include the native dll when shipping though. There's also OpenAL that you're missing. You'll need it for playing sounds.
Alternatively, you can get these .dll's by installing MonoGame or by downloading them from the dependencies repo: https://github.com/MonoGame/MonoGame.Dependencies
Easier solution, create a new DesktopGL project, copy over x86, x64 folders and .dylib files to your new project and set their build action as copy if newer.
I think the dependencies weren't in the NuGets before #5542, which was merged after the 3.6 release.
Is that right @cra0zy?
Correct.
I'm having the same issue, and was able to resolve it.
I have an existing project (developed on Windows with Visual Studio) referencing MonoGame.Framework.DesktopGL, running on an Ubuntu 16.04 VM. I am using Rider for development. At first I was seeing a DLLNotFoundException for SDL2.dll. When I first referenced the DesktopGL package (switched from WindowsDX) it pulled down a MonoGame.Framework.dll.config. I set this in the project as "Content" build type, with "Copy if newer". The paths for the dllmap were by default set to ./x86/{lib} and ./x64/{lib}.
I changed these paths so they would reference the system installed libraries instead of relative to the output directory, and then I was seeing the SDL_SetWindowResizable EntryPointNotFoundException. I've run apt-get install libsdl2-2.0 and apt-get install libsdl2-dev.
As suggested, I copied the binaries from the MonoGame.Dependencies/SDL/Linux to my output directory, and made the dllmap entries relative again. I guess this will work in the interim until the nuget package is updated with the proper dependencies. I'm making a binary dependency package for my game anyway so I can just throw those binaries in there for Linux.
Note that this may be fine for a development environment to install those to the system, but if you're output build doesn't work as a standalone, you'll have to be careful about how you package and distribute your game because the dependencies will be missing.
The preferred process is the one suggested by cra0zy.
Most helpful comment
Easier solution, create a new DesktopGL project, copy over x86, x64 folders and .dylib files to your new project and set their build action as copy if newer.
Correct.