How to compile kmscon (and libtsm) from source

Posted by in Uncategorized

Due to popular demand by an insane amount of people – one person on the entire planet – I provide here a brief step-by-step guide for grabbing, unpacking, compiling and installing kmscon using some of my patches/branches.

This is not for the meant for beginners and people new or unfamiliar with the command-line and the typical software-development tool-chain under Linux. While I wish everybody to be able use the software they desire, I cannot write a full-blown and bullet-proof guide for beginners. This is a ton of work to get done right and I do not want to waste my limited spare-time on such things… it is super boring and dull. I am just honest.

I would rather like to see my patches being reviewed and ideally accepted upstream, thus distros can easily provide the new features for interested users. But this has not happened yet, despite my pull-requests collecting dust on github for more than six months now.

Ok, here we go…

  • Point your browser to https://github.com/Aetf/libtsm and click on the green ‘Code’-button to download the zip file. That will result in a file called libtsm-develop.zip being saved on your computer.
  • Now point your browser to https://github.com/MacSlow/kmscon, click on the branch-switcher (left next to ‘Go to file’-entry) and select ‘mouse-support’ from the opened list of branches. Now download the zip-file by clicking the ‘Code’-button and then clicking ‘Download ZIP’. This will result in a file called kmscon-mouse-support.zip being saved on your computer.
  • Unpack these two zip-archives
  • This is the time when we enter the command-line. Open your preferred terminal-emulator (e.g. gnome-terminal under GNOME, konsole under KDE or whatever)
  • At this point I assume you have all needed development tools installed (cmake, meson, gcc or clang, typical library header-files and so on). If some command does not work because it is not installed or the version on your system is too old, you are on your own and find help for that elsewhere.
  • Now do this list of commands (to build and install ‘libtsm’):
    • cd libtsm-develop (needs to be adjusted to wherever you’ve unpacked libtsm-develop.zip)
    • mkdir build
    • cd build
    • cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release ..
    • make
    • sudo make install
  • Now do these commands (to build and install ‘kmscon’):
    • cd kmscon-mouse-support (needs to be adjusted to wherever you’ve unpacked kmscon-mouse-support.zip)
    • export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
    • meson setup –prefix /usr/local build -D video_drm3d=enabled -D font_pango=enabled -D renderer_gltex=enabled -D font_unifont=disabled -D renderer_pixman=disabled -D renderer_bbulk=disabled -D video_fbdev=disabled -D video_drm2d=disabled
    • cd build
    • make
    • sudo make install

If everything went smooth up to this point, you will have ‘kmscon’ with output-rotation and mouse support installed. It will not start automatically upon next reboot. In terms of general system-configuration you computer remains untouched.

In order to try it out grab this kmscon.conf file and save it in /etc on your system. That file is a basic configuration, which will start ‘kmscon’ with the OpenGL|ES render-backend and the truetype font-support. You will probably have to adjust the selected font-family and font-size to match your needs. Edit ‘kmscon.conf’ for that before you try to start it.

Now to finally try out ‘kmscon’ all that is needed is to stop your display-manger (gdm on GNOME, kdm on KDE, lightdm or whatever). For that switch to a VT with they keyboard-shortcut Ctrl-Alt-F2 to get to VT2, log in and issue a command like this:

  • sudo systemd stop gdm

Replace ‘gdm’ with your systems’ display-manager. Now execute this command:

  • sudo nohup kmscon -c /etc –login — /sbin/agetty -p ‘-o \\u’ – linux 2>/tmp/kmscon.log

If that works you will be greeted by ‘kmscon’ on VT1 (use Ctrl-Alt-F1 to switch to that). If there are any issues, view file /tmp/kmscon.log for any hints of what might have gone wrong.