Monogame on a rpi with VScode

Maybe its enough to just install sdl2 and openal from the package manager of your operating system?

Ill try that!

I just tested it by publishing the game and moving it over to a fresh installed raspberry pi os.

It worked out of the box! libopenal and libsdl2 are pre-installed.

Yea same for me, both libraries where installed, I got dotnet 6 and 3 installed a few days ago, there is no run button like there is on x86 platforms, But I can build it manually with: dotnet build [YourGameNameHere].sln but when I do that get get this error:

Microsoft (R) Build Engine version 17.0.0-preview-21458-01+2c5510013 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  /media/minystreem/EEFC-0D5D/Together/Content/dirt.png
/media/minystreem/EEFC-0D5D/Together/Content/dirt.png : error : Importer 'TextureImporter' had unexpected failure! [/media/minystreem/EEFC-0D5D/Together/Together.csproj]
  System.DllNotFoundException: Unable to load shared library 'FreeImage' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libFreeImage: cannot open shared object file: No such file or directory
     at FreeImageAPI.FreeImage.GetFileTypeS(String filename, Int32 size)
     at FreeImageAPI.FreeImage.GetFileType(String filename, Int32 size) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\Utilities\FreeImageAPI.cs:line 122
     at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import(String filename, ContentImporterContext context) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\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 C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\ContentImporter.cs:line 45
     at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\Builder\PipelineManager.cs:line 669
  /media/minystreem/EEFC-0D5D/Together/Content/player.png
/media/minystreem/EEFC-0D5D/Together/Content/player.png : error : Importer 'TextureImporter' had unexpected failure! [/media/minystreem/EEFC-0D5D/Together/Together.csproj]
  System.DllNotFoundException: Unable to load shared library 'FreeImage' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libFreeImage: cannot open shared object file: No such file or directory
     at FreeImageAPI.FreeImage.GetFileTypeS(String filename, Int32 size)
     at FreeImageAPI.FreeImage.GetFileType(String filename, Int32 size) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\Utilities\FreeImageAPI.cs:line 122
     at Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.Import(String filename, ContentImporterContext context) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\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 C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\ContentImporter.cs:line 45
     at MonoGame.Framework.Content.Pipeline.Builder.PipelineManager.ProcessContent(PipelineBuildEvent pipelineEvent) in C:\BuildAgents\MonoGameWin1\work\f7381a85a626990\MonoGame.Framework.Content.Pipeline\Builder\PipelineManager.cs:line 669
/home/minystreem/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build/MonoGame.Content.Builder.Task.targets(138,5): error MSB3073: The command "dotnet /home/minystreem/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build//../tools/netcoreapp3.1/any/mgcb.dll /quiet /@:"/media/minystreem/EEFC-0D5D/Together/Content/Content.mgcb" /platform:DesktopGL /outputDir:"/media/minystreem/EEFC-0D5D/Together/Content/bin/DesktopGL/Content" /intermediateDir:"/media/minystreem/EEFC-0D5D/Together/Content/obj/DesktopGL/Content" /workingDir:"/media/minystreem/EEFC-0D5D/Together/Content/"" exited with code 2. [/media/minystreem/EEFC-0D5D/Together/Together.csproj]

Build FAILED.

/media/minystreem/EEFC-0D5D/Together/Content/dirt.png : error : Importer 'TextureImporter' had unexpected failure! [/media/minystreem/EEFC-0D5D/Together/Together.csproj]
/media/minystreem/EEFC-0D5D/Together/Content/player.png : error : Importer 'TextureImporter' had unexpected failure! [/media/minystreem/EEFC-0D5D/Together/Together.csproj]
/home/minystreem/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build/MonoGame.Content.Builder.Task.targets(138,5): error MSB3073: The command "dotnet /home/minystreem/.nuget/packages/monogame.content.builder.task/3.8.0.1641/build//../tools/netcoreapp3.1/any/mgcb.dll /quiet /@:"/media/minystreem/EEFC-0D5D/Together/Content/Content.mgcb" /platform:DesktopGL /outputDir:"/media/minystreem/EEFC-0D5D/Together/Content/bin/DesktopGL/Content" /intermediateDir:"/media/minystreem/EEFC-0D5D/Together/Content/obj/DesktopGL/Content" /workingDir:"/media/minystreem/EEFC-0D5D/Together/Content/"" exited with code 2. [/media/minystreem/EEFC-0D5D/Together/Together.csproj]
    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:15.95

I have not found out how to fix it yet, what did you do to run it on your pi?

  1. I created a new DesktopGL project, using Monogame 3.8.1.303
  2. Added this line to the csproj file:
    <PublishSingleFile>true</PublishSingleFile>
  3. Run the command:
    dotnet publish -r linux-arm --self-contained
  4. Copied the bin/Debug/net6.0/linux-arm/publish/ Folder over to the raspberry pi
  5. Ran the executable

I’ll try it out

I did that but still got the same error

Maybe try to sudo apt install libfreeimage3

Are you developing on the Pi? I build the game on a x64 machine and then copied the output over to the pi.

Yea that was my goal, to develop on a pi

Btw. I used dotnet 6 with the latest monogame version.

me too

Monogame is using a lot of dependencies. Most of these “blobs” only come prebuild for x86 and x64 as .so or .dll file.

1 Like

@minystreem Good news. I got monogame to build on a pi, but only without the content builder.

Also take a look at this discussion:

The problem and the only problem, is to have a arm build for all dependencies:

In the meanwhile you could load your Assets from File. For example:
public static Texture2D FromFile(GraphicsDevice graphicsDevice, string path)

Sorry for the late response. I was able to get a blank monogame project compiled and running, but I can’t open the mbgc editor to add images, so the images in my game is whats causing it to not build.

just realized your have the same problem XD, I might just use qemu to run windows.

I don’t get it. Why go through so much trouble to develop on pretty weak hardware when you have better alternatives? If you want to develop on the go, get a used/cheap laptop.

because my school doesn’t allow laptops other then the school issued chromebooks

plus its a fun little challenge, and the pi is a readily available machine.

I guess I could compile it with Bridge.NET