SDL2 error on RISC-V

I’m porting an app to StarFive VisionFive2 RISC-V @64bit Linux.
Compile work well, but once run, the app quit without creating any window.

Current init is as so:
and the error shown is:
SDL_Init Error: wayland not available
WL: ERROR initializing graphic system. Program aborted.

I tryed to change the init to:
and the error shown is:
SDL_CreateWindow Error: wayland not available
WL: ERROR initializing graphic system. Program aborted.

In the second case the error happen on
winPtr = SDL_CreateWindow(“Wilderland - A Hobbit Environment”, 40, 24, MAINWINWIDTH, MAINWINHEIGHT, WinMode | SDL_WINDOW_HIDDEN|SDL_WINDOW_ALLOW_HIGHDPI);


Compile time SDL v.2.26.1
Link time SDL v.2.26.1

Someone can send me any hints, please?

Maybe you is just trying without a X11 window or wayland?
Here in my Xubuntu I use SDL2 just with X11.
Before SDL2 the SDL1.2 runs onframebuffer, but it appears was abandoned the support to framebuffer (which able any sdl1.2 app can run without wayland or x11).

as Windows Manager I use LightDM, while as Desktop Manager I use GNOME. Then I open a Terminal and launch the app.
Other Apps like Xeyes work, so DISPLAY is defined and X is available, I do not know if Wayland is already implemented on RISC-V.
Do you know how to choose between X11 and Framebuffer as backend for SDL2 (I prefer to have both, but at least one can be a good start)?

Games which would like to prefer wayland when available can use the following code before SDL_Init():
	SDL_SetHint(SDL_HINT_VIDEODRIVER, "wayland,x11");

So in your case you would use something like

SDL_SetHint(SDL_HINT_VIDEODRIVER, "x11,directfb");



Before you go compiling though, you could just try twiddling with the environment variable SDL_VIDEODRIVER instead. Then you could for instance call your application like so:

SDL_VIDEODRIVER=x11 ./whateverthisgamebinaryiscalled
1 Like

WOW, will try. Thank you

1 Like