The utility controllermap used to be built and installed when you installed libsdl2-dev. However you can build and run it, if you follow these instructions.
SDL3 BTW uses a different application.
The utility controllermap is one of a number of test programs and if you have cmake installed you can build the lot. These instructions are just how to build controllermap and I’ve built it on a Raspberry PI.
Step 1.
Download the source code. Start on libsdl.org and click SDL Releases on that page. This has SDL3 releases but at the top you’ll see
Releases / Release 3.X.X. Click Releases and on this new page you can see both SDL3 and SDL2 releases. Scroll down a page or so until you find the first SDL2 release which is currently 2.32.2 but may change. Click the arrow by Assets and you should see a bunch of files.
Download the source code file that you prefer (zip/tar.gz) and extract the test folder. We don’t need most of its files but it’s just easier to work with the test folder’s contents.
I used VS Code and clang to build it. I expect gcc will work as well.
Open the Test folder as the Folder in VS Code. You need to have SDL2 dev files installed. If you haven’t, my article how to install SDL on Linux shows how.
We need three source files: controllermap.c and testutils.h/c.
I had to make a couple of slight mods to controllermap.c and testutils.h, changing the path of SDL files to “SDL2/SDL.h”
Next, you need to create a .vscode folder in the Test folder and create a tasks.json to build it.
This specifies the additional source file(s) and also the SDL modules to link in.
After this you should be able to build it and run it with
./controllermap
from a terminal opened in the tests folder.
If you have a different version of clang- as shown by this terminal command
clang --version
edit tasks.json and change it. This is the tasks.json I used to build controllermap
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "clang-14.0 build active file",
"command": "/usr/bin/clang-14",
"args": [
"-g",
"${file}",
"${workspaceFolder}/testutils.c",
"-o",
"${fileDirname}/${fileBasenameNoExtension}",
"-lSDL2",
"-lSDL2_image",
"-lm"
],
"options": {
"cwd": "/usr/bin"
},
"group": "build"
},
]
}