DeamonHunter / AWBW-Replay-Player

Advance Wars By Web Replay Player
MIT License
38 stars 5 forks source link

libicu error when running on NixOS #122

Open Pauan opened 1 year ago

Pauan commented 1 year ago

I'm trying to run this on NixOS. I downloaded the AppImage and ran it, but I get this error:

Process terminated. Couldn't find a valid ICU package installed on the system. Please install libicu using your package manager and try again. Alternatively you can set the configuration flag System.Globalization.Invariant to true if you want to run with no globalization support. Please see https://aka.ms/dotnet-missing-libicu for more information.
   at System.Environment.FailFast(System.String)
   at System.Globalization.GlobalizationMode+Settings..cctor()
   at System.Globalization.CultureData.CreateCultureWithInvariantData()
   at System.Globalization.CultureData.get_Invariant()
   at System.Globalization.CultureInfo..cctor()
   at System.Globalization.CultureInfo.get_CurrentCulture()
   at osuTK.Vector2..cctor()
   at osu.Framework.Graphics.Containers.CompositeDrawable..ctor()
   at osu.Framework.Graphics.Containers.Container`1[[System.__Canon, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor()
   at osu.Framework.Graphics.Containers.Container..ctor()
   at osu.Framework.Game..ctor()
   at AWBWApp.Game.AWBWAppGameBase..ctor()
   at AWBWApp.Game.AWBWAppGame..ctor()
   at AWBWApp.Desktop.AWBWAppGameDesktop..ctor()
   at AWBWApp.Desktop.Program.Main()

Unlike other Linux distros, NixOS doesn't have a libicu package. It seems this is causing problems with other .NET programs as well.

Ideally this would be fixed within NixOS, but it would be a lot faster and easier if the AWBW replay viewer disabled ICU. This is quite easy to do, you simply change a setting in your csproj files. The downside is that you lose support for language-specific dates, but I don't think that matters for the replay viewer.

DeamonHunter commented 1 year ago

Yo. So I've looked around at the framework I'm using (https://github.com/ppy/osu-framework) and the main game created with it (https://github.com/ppy/osu) and I'm not seeing any reports on this type of error.

Is there possibly something setup to make these work? I'm not that well versed with linux, and particularly anything outside of ubuntu. One hint I did find while looking was https://github.com/NixOS/nixpkgs/tree/master/pkgs/games/osu-lazer which does suggest someone has gotten it working.

Pauan commented 1 year ago

ICU is not framework-specific, it's a fundamental part of .NET, so it will affect any .NET program, it has nothing to do with osu.

Normally, NixOS programs are statically linked, so this problem doesn't happen, because it will use the statically linked version of icu.

However, you are distributing the replay viewer as an AppImage, which is dynamically linking to icu, that's why it has the problem, because it cannot find icu.

DeamonHunter commented 1 year ago

Upon further reading, I think the proper fix may be exactly what I linked before: https://github.com/NixOS/nixpkgs/tree/master/pkgs/games/osu-lazer

If I understand correctly, it probably gets around the dynamic linking issue by just building it itself upon installing the package. I recommend doing this myself, as I don't particularly want to force invariant culture.

I have made a copy of the above and made some edits to the package to maybe support getting AWBW Replay Player working. But be warned it is 100% untested and will need some massaging to get it to work. (Including making the deps file.) AWBW-App-NixOS.zip

Pauan commented 1 year ago

That will download the source code from this repository, compile everything from source, and then statically link everything. That's quite a lot more complicated than just running the AppImage.