::folder::

How to build and install SDL library [EN][10/08/2024]

First of all, I need to say that the 'tutorial' below is not quite a tutorial. I know this sounds contradictory, but that's because I am not doing it to teach people; I'm actually writing this post 'cause, at the moment, I am learning SDL and wanted an easy place to remember the commands to build and install this development library.

With this said: welcome, daniel. Here you'll learn how you can build and install SDL. The first thing you need to do is clone the SDL repo with Git:

git clone -b release-2.30.x --depth 1 https://github.com/libsdl-org/SDL.git

After cloning the repo, you'll need to go into the SDL folder (usually called "SDL" or "SDL_main") and create a new folder inside it called "build". After that, you go into this new folder and execute the following command:

../configure

It'll configure and prepare everything for the up-coming compilation. Then you'll only need to execute the basic make build commands:

make
sudo make install

And done! Congrat's, you just built and installed SDL. Oh!, and one last note: i know you often have trouble finding where SDL had been installed. To be kind and help you (future daniel), here's a command line to show you where this library is:

sdl2-config --libs --cflags

[Back to the Old Writing Room]