site  contact  subhomenews

Agar GUI toolkit with SDL 1.2 on Linux framebuffer

February 25, 2019 — BarryK

I want to run simple GUI apps directly on the framebuffer, no X, and with UTF-8 support. This is to run in the initrd, before switch_root to the main filesystem. I was playing with 'fbterm', as reported earlier:

But then, why not go the extra step, and have proper graphics-mode GUIs, rather than text-mode? There are some very nice GUI toolkits, but most require SDL version 2, which does not work with the framebuffer. LittleVGL is extra nice, and I have posted many times about it -- it can work directly with the framebuffer, however, mouse input only, no keyboard.

Then I discovered Agar, which uses SDL 1.2. I compiled it, but SDL seems unable to work with the Linux framebuffer:

SDL_Init: no suitable video device

So, decided to recompile SDL, version 1.2.15, narrowed it right down, so only works on the framebuffer:

# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --build=x86_64-pc-linux-gnu --without-x --disable-input-tslib --disable-screensaver --disable-osmesa-shared --disable-video-opengl --disable-video-dummy --disable-video-gem --disable-video-wscons --disable-video-vgl --disable-video-svga --disable-video-ggi --disable-video-cocoa --disable-video-carbon --disable-video-photon --disable-video-x11 --enable-video-fbcon --disable-mintaudio --disable-diskaudio --disable-nas --disable-arts --disable-pulseaudio --disable-esd --disable-alsa --disable-oss

...that did the trick!

Then recompiled Agar:

# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-sdl --without-x --without-glx --without-xinerama --with-png --with-jpeg --without-gl --with-fontconfig --with-freetype --without-portaudio --without-sndfile --without-sse --with-single-fp --without-db4 --disable-network --enable-gui
# make depend all
# new2dir make install

# cd test
# ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
# make

...that last operation generated 'agartest', and these are it's deps:

# ldd ./agartest (0x00007ffe9edb8000) => /usr/lib/ (0x00007f2b306b2000) => /lib/ (0x00007f2b303a5000) => /usr/lib/ (0x00007f2b30197000) => /usr/lib/ (0x00007f2b2fe6b000) => /usr/lib/ (0x00007f2b2fc05000) => /usr/lib/ (0x00007f2b2f99b000) => /lib/ (0x00007f2b2f77e000) => /usr/lib/ (0x00007f2b2f4df000) => /usr/lib/ (0x00007f2b2f29d000) => /usr/lib/ (0x00007f2b2f033000) => /usr/lib/ (0x00007f2b2ee02000) => /lib/ (0x00007f2b2ebec000) => /lib/ (0x00007f2b2e9e8000) => /lib/ (0x00007f2b2e655000)
    /lib/ (0x00007f2b308f4000) => /usr/lib/ (0x00007f2b2e42d000)

...good. Copied 'agartest' to '/', exited from X, ran it, great, it works, lots of widgets and they look nice. Yep, this is what I want!

Here is the Agar home page:

A snapshot of 'agartest':


Next up, will revisit the Agar configuration, see if can be cut down any more. 

Tags: easy