Could not initialize SDL: No available video device


#1

I am trying to run a OpenFl project on NixOs (a linux derivative using the functional nix package manager), but I am getting an error message every time I try to run the program.

Could not initialize SDL: No available video device.
Could not create SDL window: No available video device.
Could not create SDL renderer: Invalid window.

To me it looks like lime.ndll is having issues reaching SDL (which is installed), but I’m not exactly sure what is going on.


#2

lime.ndll includes SDL, so SDL is initializing, and says it has no video device available. I think it is probably using X11, we might not be building for Wayland or Mir. What window manager are you using?


#3

I am using awesome as my window manager and lightdm as my display manager. If you are familiar with nixos, this is the file I am using to define my X11 environment.

{ pkgs, ... }:

{
  services.xserver.enable = true;
  services.xserver.layout = "us";

  # Make brightness keys work
  services.illum.enable = true;

  # Make sound control keys work
  sound.mediaKeys.enable = true;

  # Set the default x session to i3
  services.xserver.displayManager.lightdm.enable = true;
  services.xserver.windowManager.awesome.enable = true;

  # Add some fonts for unicode and stuff!
  fonts.fonts = with pkgs; [
      noto-fonts
      noto-fonts-cjk
      noto-fonts-emoji
      liberation_ttf
      fira-code
      fira-code-symbols
      mplus-outline-fonts
      dina-font
      proggyfonts
  ];
}

#4

Perhaps this is related:


#5

Okay, so I tried installing those libraries, but it doesn’t look like that did anything. Looks like this needs to be figured out on the NixOS side of things. Knowing what libraries are needed will help a lot though.


#6

Another approach might be if we tried building SDL with a different display server supported, perhaps the configuration would be more compatible. Using a development build of Lime, these are the packages we install (or similar to them) to be able to rebuild our native library: https://github.com/openfl/lime#building-from-source

Perhaps some of the additional drivers could be enabled in the Linux config, and could try lime rebuild linux with those enabled, and see if one of them picks things up automatically


#7

I ran the generated binary with LD_DEBUG=libs set in the environment. This is the result. It looks like the libX libraries all failed to bind. None of them looked in the paths where the libraries where actually installed, and I don’t know why. It looks to me like this is a NixOS issue, so I opened one up on the NixOS github repository.