[Solved] "No available video device" 2.0.7/w10/cygwin


#1

Using Win10, Cygwin, GCC 7, SDL 2.0.7 (as provided by Cygwin)

Trying to get the dead simplest Hello program to work (from http://lazyfoo.net/tutorials/SDL/01_hello_SDL/index2.php) but it does not go. On startup I get this enigmatic error from SDL_Init: “No available video device”.

For fun I also tried a previous Hello for SDL 1.2 and got similar results, so it’s not specific to v2.

I did grab a copy of the 2.0.9 source to try, but couldn’t get past the configure script. My gcc doesn’t make Win32 binaries it seems.

I might be missing something obvious, I’m still very much an SDL noob. Googling the error brings up a lot about Linux and X but no help for Windows.


#2

Following up myself here.

The short answer I found is that Cygwin’s SDL build is somehow broken and I don’t know why. My attempted build of 2.0.9 was faulty and worked better with a freshly unpacked source tree.

I got a clean build of libsdl2.a, but I also got a libsdl2.dll.a. My Hello builds and links now, but fails to run when sdl2.dll is not found. That seems odd for a Unixy thing, but it’s Windows so <shrug>. I found several (dozen) instances of sdl2.dll on my system attached to misc. apps, and eventually found one that works. That was a 32- vs 64-bit thing.

Next I fired up VS17 and coaxed it into building me a fresh copy of sdl2.dll that also worked with my Hello. That’s a big box checked off, now I can rummage around in there and break things to my liking.

I do miss the simplicity of just writing bytes into a frame buffer (1993 called, wants its MS-DOS back). I know SDL is very powerful and -relatively- simple, but I sort of feel like an old prospector looking at the ten-lane superhighway that stands where his old mule trail used to be…very shiny but a lot more complicated. But I think I can see the way forward from here.


#3

Does it work if you build with whatever cygwin provides but make the application use the SDL2.dll from the official runtime binary download (https://www.libsdl.org/download-2.0.php)?
(I think it should, but I don’t know if cygwin does anything weird that breaks the ABI)


#4

I’m not sure I can answer that, but here’s what I saw. Using the Cygwin build, my Hello got the title error string via SDL_GetError(), so an SDL library of some kind was in play, but I don’t think that it was sdl2.dll. Cygwin does put a cygSDL2-2-0-0.dll into /bin though.

Next I uninstalled the Cygwin build of SDL2 and ran a regular conf/make/install on the SDL2 sources with plain gcc 7.4. This time my Hello failed with a Windows popup indicating sdl2.dll was not found. After I found it and copied it to my path, that same Hello then worked without rebuilding. I think this suggests that Cygwin’s SDL DLL isn’t built quite right.

After I found the random sdl2.dll that let my Hello run correctly, I did download the official sdl2.dll and found it to be identical to the one I found, so to that point I can say yes.