German Empire Ball
German Empire Ball

Reputation: 31

No Available Video Device in SDL

The SDL-2 library I'm using was compiled from source.

Whenever I try to run any program that uses SDL-2 on X11, I am given this error:

SDL_Init Error: No available video device

I am running these programs through the command line on Linux Mint 19.3 Tricia.

Here's the ./configure summary:

SDL2 Configure Summary:
Building Shared Libraries
Building Static Libraries
Enabled modules : atomic audio video render events joystick haptic sensor power filesystem threads timers file loadso cpuinfo assembly
Assembly Math   : mmx 3dnow sse sse2 sse3
Audio drivers   : disk dummy oss
Video drivers   : dummy opengl_es2 vulkan
Input drivers   : linuxev linuxkd
Using libsamplerate : NO
Using libudev       : NO
Using dbus          : NO
Using ime           : YES
Using ibus          : NO
Using fcitx         : NO

Upvotes: 2

Views: 3579

Answers (1)

genpfault
genpfault

Reputation: 52083

Looks like your SDL build is missing the X11 backend.

Mint looks sufficiently Debian-y that a sudo apt build-dep libsdl2 ought to pull in the required -dev packages. Then you can re-run ./configure & rebuild/reinstall SDL.

Make sure to double-check that the Video drivers line in the configure summary has the backends you're interested in using.

If the build-dep method is too hand-wavy then docs/README-linux.md has a (kinda old) itemized -dev package list:

================================================================================
Build Dependencies
================================================================================
    
Ubuntu 13.04, all available features enabled:

sudo apt-get install build-essential mercurial make cmake autoconf automake \
libtool libasound2-dev libpulse-dev libaudio-dev libx11-dev libxext-dev \
libxrandr-dev libxcursor-dev libxi-dev libxinerama-dev libxxf86vm-dev \
libxss-dev libgl1-mesa-dev libesd0-dev libdbus-1-dev libudev-dev \
libgles1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libibus-1.0-dev \
fcitx-libs-dev libsamplerate0-dev libsndio-dev

Ubuntu 16.04+ can also add "libwayland-dev libxkbcommon-dev wayland-protocols"
to that command line for Wayland support.

NOTES:
- This includes all the audio targets except arts, because Ubuntu pulled the 
  artsc0-dev package, but in theory SDL still supports it.
- libsamplerate0-dev lets SDL optionally link to libresamplerate at runtime
  for higher-quality audio resampling. SDL will work without it if the library
  is missing, so it's safe to build in support even if the end user doesn't
  have this library installed.
- DirectFB isn't included because the configure script (currently) fails to find
  it at all. You can do "sudo apt-get install libdirectfb-dev" and fix the 
  configure script to include DirectFB support. Send patches.  :)

Upvotes: 3

Related Questions