Skip to content

Could not CreateWindow(): IWindowingPlatform is not registered #266

Open

Description

@stefanwatt

I compiled from source and I get this error when trying to launch fvim:

Unhandled exception. System.Exception: Could not CreateWindow(): IWindowingPlatform is not registered.
   at Avalonia.Controls.Platform.PlatformManager.CreateWindow()
   at Avalonia.Controls.Window..ctor()
   at FVim.CrashReport..ctor()
   at FVim.Program.startCrashReportWindow(FSharpFunc`2 app, Exception ex)
   at FVim.Program.Main(String[] args)
[1]    56833 IOT instruction (core dumped)  /home/stefan/Projects/fvim/bin/Release/net6.0/linux-x64/publish/FVim

My System:

$ dotnet --list-runtimes                                                                                                                                      [23:47:42]
Microsoft.AspNetCore.App 6.0.25 [/nix/store/k1ld6p66rdvzlcqhrnmhgllycr745490-dotnet-sdk-6.0.417/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.25 [/nix/store/k1ld6p66rdvzlcqhrnmhgllycr745490-dotnet-sdk-6.0.417/shared/Microsoft.NETCore.App]

stefan@nixos: ~
$ dotnet --version                                                                                                                                            [23:51:31]
6.0.417

Am I missing dependencies? ChatGPT suggested libX11 might be an issue, but it's installed on my system, too. Maybe it can't fight it under the usual path cause I'm using nixos?

Activity

  1. nbfritch commented on May 17, 2024

    @nbfritch

    I also ran into this issue on NixOS.
    I found the libraries that were failing to be loaded by using strace dotnet bin/Release/net6.0/FVim.dll.
    Here is the flake containing the devShell I was able to get FVim to run with:

    {
      inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
      };
      outputs = { self, nixpkgs }:
        let pkgs = nixpkgs.legacyPackages.x86_64-linux.pkgs;
        in
        {
          devShells.x86_64-linux.default = pkgs.mkShell rec {
            buildInputs = with pkgs; [
              bashInteractive
              dotnet-sdk_6
              dotnet-runtime_6
              xorg.libX11
              xorg.libX11.dev
              xorg.xorgserver
              xorg.libXcursor
              xorg.libXcursor.dev
              xorg.xrandr
              xorg.libXrandr
              xorg.libXrandr.out
              xorg.libXrandr.dev
              xorg.libXi
              xorg.libXi.dev
              xorg.libXext
              xorg.libXext.dev
              xorg.libICE
              xorg.libICE.dev
              xorg.libSM
              fontconfig
              libz
              libz.dev
            ];
          shellHook = ''
            export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath buildInputs}
          '';
          };
        };
    }

    I'm not sure if both lib and lib.dev are required in buildInputs.

    For anyone encountering this in the future, the libraries Avalonia requires to launch are libX11, xorgserver, libXcursor, libXrandr, libXi, libXext, libICE, libSM, libz, and fontconfig

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions