Lazy Foo' Productions

SDL Forums external link SDL2 Tutorials SDL3 Tutorials Articles OpenGL Tutorials OpenGL Forums external link
Follow BlueSky Follow Facebook Follow Twitter Follow Threads
Donate
News FAQs Contact Bugs

Setting up SDL on Linux

Last Updated: Oct 13th, 2026

First we're going to set up the SDL libraries via the CLI and then we'll be building the application via IDE (which is a work in progress at the moment).

Oh and if you're new to Linux game development and are looking for a good beginner OS, a good rule of thumb is looking at the charts for the most popular Linux OS on steam and seeing what's the top distro. At time of writing it's CatchyOS and it was probably the smoothest dev experience I had on the distros I tried for this tutorial.

Package Manager Support

Linux comes in too many flavors for one tutorial set to support. I will try to support the same package managers that SDL supports in its documentation, namely:
  • Pacman (with CachyOS)
  • APT (with Ubuntu)
  • Zypper (with OpenSUSE)
  • DNF (with CentOS)
We will also be compiling from source with the help the above package managers. If you were hoping to get SDL3 working with your Linux from Scratch distro meant to run on a toaster, I'm sorry but you're on your own.

Setting up SDL3 on Linux With Package Managers

For this tutorial we will assume you're starting from your home directory.

1) First thing we want to do is download the tutorial source code and unzip it:
wget https://lazyfoo.net/tutorials/SDL3/01-hello-sdl3/01-hello-sdl3.zip
unzip 01-hello-sdl3.zip

2) Try to compile the source code:
g++ 01-hello-sdl3/01-hello-sdl3.cpp -o 01_hello_sdl3.bin
And you'll get the following error:
fatal error: SDL3/SDL.h: No such file or directory

This makes sense since SDL3 is not a standard C/C++ library. We'll have to install it.
  • Pacman: sudo pacman --noconfirm -S sdl3
  • APT: sudo apt install libsdl3-dev -y
  • Zypper: sudo zypper install -y SDL3-devel
  • DNF: sudo dnf install SDL3-devel -y (May not be ready. May have to compile from source)

3) Try to compile again:
g++ 01-hello-sdl3/01-hello-sdl3.cpp -o 01_hello_sdl3.bin
And you'll get the following error:
undefined reference to `SDL_Init'
This happens because while SDL3 is installed and the compiler can now find the header file it couldn't find before, but the compiler needs to be told to link against it.

Try to compile again with the linker SDL3 flag:
g++ 01-hello-sdl3/01-hello-sdl3.cpp -lSDL3 -o 01_hello_sdl3.bin
And now the application should run:
./01_hello_sdl3.bin

Now that you also have SDL set up, you can move onto the second part of the tutorial.

Setting up SDL3 on Linux By Building From Source

Say if your distro doesn't support SDL3 in its package manager yet (I'm looking at you RedHat) or you want to tinker with the SDL source code, you can build the source code yourself.

1) If you haven't already, go download the tutorial source code and unzip it:
wget https://lazyfoo.net/tutorials/SDL3/01-hello-sdl3/01-hello-sdl3.zip
unzip 01-hello-sdl3.zip

2) Try to compile the source code:
g++ 01-hello-sdl3/01-hello-sdl3.cpp -o 01_hello_sdl3.bin
And you'll get the following error:
fatal error: SDL3/SDL.h: No such file or directory
This makes sense since SDL3 is not a standard C/C++ library. We'll have to build install it.

3) Now you'll want to download the SDL3 source code. Go to the SDL releases page and find the latest version number. At time of writing it's 3.4.14 but it is most likely going to be something different when you go the page. Download the source code and unzip it. Again, we are assuming you are working from your home directory:
wget https://github.com/libsdl-org/SDL/archive/refs/tags/release-3.4.14.zip -O sdl3-release-3.4.14.zip
unzip sdl3-release-3.4.14.zip
For some of you who are wondering, yes you can also pull the latest source code using Git. However, I do recommend using official releases because the main branch is the latest commit which may not be stable.

4) In an ideal world, it only takes 5 commands to build and install SDL from source:
  • cd SDL-release-3.4.14 Go into the source directory
  • cmake -S . -B build Configure the build
  • cmake --build build Run the build
  • cd build Go into the build directory
  • sudo make install Install the library
This assumes you have have all your dependency libraries installed, which you will most likely don't. So let's attempt to build and see what kind of errors we can run into. Go into the source directory:
cd SDL-release-3.4.14
and attempt to run the CMake build configuration:
cmake -S . -B build

The first error you might get is a basic one: Command 'cmake' not found
Which can be fixed by installing cmake:
  • Pacman: sudo pacman --noconfirm -S cmake
  • APT: sudo apt install cmake -y
  • Zypper: sudo zypper install -y cmake
  • DNF: sudo dnf install cmake -y

5) Attempt to run the CMake build configuration again (cmake -S . -B build) and you'll likely get the following error due to missing dependencies:
SDL could not find X11 or Wayland development libraries on your system.

To find out which dependencies you need to install for you distro, check out the SDL linux documentation. Double check with the lastest documentation because this might be out of date.

Pacman for Arch Based Distros

6) You'll need to install:
sudo pacman --noconfirm -S alsa-lib cmake hidapi ibus jack libdecor libthai fribidi libgl libpulse libusb libx11 libxcursor libxext libxfixes libxi libxinerama libxkbcommon libxrandr libxrender libxss libxtst mesa ninja pipewire sndio vulkan-driver vulkan-headers wayland wayland-protocols

Run the build configuration: cmake -S . -B build
Run the build: cmake --build build
Go into the build directory: cd build
Install the library: sudo make install (pay attention to where it installs libSDL3.so.0)

APT for Debian Based Distros

6) You'll need to install:
sudo apt-get install -y build-essential git make pkg-config cmake ninja-build gnome-desktop-testing libasound2-dev libpulse-dev libaudio-dev libfribidi-dev libjack-dev libsndio-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxtst-dev libxkbcommon-dev libdrm-dev libgbm-dev libgl1-mesa-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev libthai-dev libusb-1.0-0-dev libpipewire-0.3-dev libwayland-dev libdecor-0-dev liburing-dev

Run the build configuration: cmake -S . -B build
Run the build: cmake --build build
Go into the build directory: cd build
Install the library: sudo make install (pay attention to where it installs libSDL3.so.0)

Zypper for SuSE Based Distros

6) You'll need to install:
sudo zypper install -y libunwind-devel libusb-1_0-devel Mesa-libGL-devel libxkbcommon-devel libdrm-devel libgbm-devel pipewire-devel libpulse-devel sndio-devel Mesa-libEGL-devel alsa-devel xwayland-devel wayland-devel wayland-protocols-devel libthai-devel fribidi-devel

Attempt to run the build configuration: cmake -S . -B build
You may get the following errors:
  • Couldn't find dependency package for XCURSOR. Please install the needed packages or configure with -DSDL_X11_XCURSOR=OFF
  • Couldn't find dependency package for XINPUT. Please install the needed packages or configure with -DSDL_X11_XINPUT=OFF
  • Couldn't find dependency package for XFIXES. Please install the needed packages or configure with -DSDL_X11_XFIXES=OFF
  • Couldn't find dependency package for XRANDR. Please install the needed packages or configure with -DSDL_X11_XRANDR=OFF
  • Couldn't find dependency package for XSCRNSAVER. Please install the needed packages or configure with -DSDL_X11_XSCRNSAVER=OFF
  • Couldn't find dependency package for XTEST. Please install the needed packages or configure with -DSDL_X11_XTEST=OFF
Run the configuration with those flags turned off: cmake -S . -B build -DSDL_X11_XCURSOR=OFF -DSDL_X11_XINPUT=OFF -DSDL_X11_XFIXES=OFF -DSDL_X11_XRANDR=OFF -DSDL_X11_XTEST=OFF -DSDL_X11_XSCRNSAVER=OFF
Run the build: cmake --build build
Go into the build directory: cd build
Install the library: sudo make install (pay attention to where it installs libSDL3.so.0)

DNF for RedHat Based Distros

6) You'll need to install:
sudo dnf install gcc git-core make cmake alsa-lib-devel fribidi-devel pulseaudio-libs-devel pipewire-devel libX11-devel libXext-devel libXrandr-devel libXcursor-devel libXfixes-devel libXi-devel libXScrnSaver-devel libXtst-devel dbus-devel ibus-devel systemd-devel mesa-libGL-devel libxkbcommon-devel mesa-libGLES-devel mesa-libEGL-devel vulkan-devel wayland-devel wayland-protocols-devel libdrm-devel mesa-libgbm-devel libusb1-devel libdecor-devel pipewire-jack-audio-connection-kit-devel libthai-devel liburing-devel
You may get No match for argument errors. Just remove the offending libraries from the install command.

Attempt to run the build configuration: cmake -S . -B build
You may get the following error:
  • Couldn't find dependency package for XSCRNSAVER. Please install the needed packages or configure with -DSDL_X11_XSCRNSAVER=OFF
Run the configuration with those flags turned off: cmake -S . -B build -DSDL_X11_XSCRNSAVER=OFF
Run the build: cmake --build build
Go into the build directory: cd build
Install the library: sudo make install (pay attention to where it installs libSDL3.so.0)

With SDL3 Installed

7) Return the home directory (cd ~) and try to compile again:
g++ 01-hello-sdl3/01-hello-sdl3.cpp -o 01_hello_sdl3.bin
And you'll get the following error:
undefined reference to `SDL_Init'
This happens because while SDL3 is installed and the compiler can now find the header file it couldn't find before, the compiler needs to be told to link against it.

Try to compile again with the linker SDL3 flag:
g++ 01-hello-sdl3/01-hello-sdl3.cpp -lSDL3 -o 01_hello_sdl3.bin
And now the application should run:
./01_hello_sdl3.bin
However you may get the following error: error while loading shared libraries: libSDL3.so.0: cannot open shared object file: No such file or directory

The above error about the missing libSDL3.so.0 file is because your distro can't find the library we compiled. To point it to the library we installed, we have to set the LD_LIBRARY_PATH variable.

8) For Arch based distros running the Fish shell, this will update the variable globally and permanently:
set -Ux LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/usr/local/lib"

For Apt based distros like Ubuntu:
sudo vim /etc/environment   #Open up the global environment config file
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib   #Append the path to the libSDL3.so.0 file
reboot   #Exit Vim and reboot to make it permanent
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib   #Or you can set the variable in your current shell to use it until your next reboot
For Zypper based distros like OpenSuSE:
sudo vim /etc/environment   #Open up the global environment config file
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Append the path to the libSDL3.so.0 file
reboot   #Exit Vim and reboot to make it permanent
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Or you can set the variable in your current shell to use it until your next reboot
For DNF based distros like CentOS:
sudo vim /etc/environment   #Open up the global environment config file
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Append the path to the libSDL3.so.0 file
reboot   #Exit Vim and reboot to make it permanent
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Or you can set the variable in your current shell to use it until your next reboot
At this point the application should run without issue:
./01_hello_sdl3.bin

Now that you also have SDL set up, you can move onto the second part of the tutorial.

Setting up SDL Extension Libraries

Guys, I really hate doing set up tutorials. They are just so time consuming and tedious. Rather than create a separate tutorial for SDL_image, an extension library that allows you to load many different image formats, I will just add it here.

Knowing how to set up extension libraries is important because they add very useful functionality like loading TTF fonts or advanced audio. Here we're going to add SDL_image loading to the first tutorial.

1) First, download a tutorial source code to test the SDL extension library installation:
  • SDL3_image: wget https://lazyfoo.net/tutorials/SDL3/02-textures-and-extension-libraries/02-textures-and-extension-libraries.zip
    unzip 02-textures-and-extension-libraries.zip
  • SDL3_ttf: wget https://lazyfoo.net/tutorials/SDL3/08-true-type-fonts/08-true-type-fonts.zip
    unzip 08-true-type-fonts.zip
  • SDL3_mixer: wget https://lazyfoo.net/tutorials/SDL3/15-sound-effects-and-music/15-sound-effects-and-music.zip
    unzip 15-sound-effects-and-music.zip
2) Now attempt to compile the code and you should get an error back:
  • SDL3_image:
    g++ 02-textures-and-extension-libraries/02-textures-and-extension-libraries.cpp -lSDL3 -o 02-textures-and-extension-libraries.bin
    fatal error: SDL3_image/SDL_image.h: No such file or directory
  • SDL3_ttf:
    g++ 08-true-type-fonts/08-true-type-fonts.cpp -lSDL3 -o 08-true-type-fonts.bin
    fatal error: SDL3_image/SDL_image.h: No such file or directory
  • SDL3_mixer:
    g++ 15-sound-effects-and-music/15-sound-effects-and-music.cpp -lSDL3 -o 15-sound-effects-and-music.bin
    fatal error: SDL3_mixer/SDL_mixer.h: No such file or directory
Again, this makes sense since the extension library is not installed.

To fix this, to install SDL_image:
  • Pacman: sudo pacman --noconfirm -S sdl3_image
  • APT: sudo apt install libsdl3-image-dev -y
  • Zypper: sudo zypper install -y SDL3_image-devel
  • DNF: sudo dnf install SDL3_image-devel -y (May not be ready. May have to compile from source)
For SDL_ttf it would be:
  • Pacman: sudo pacman --noconfirm -S sdl3_ttf
  • APT: sudo apt install libsdl3-ttf-dev -y
  • Zypper: sudo zypper install -y SDL3_ttf-devel
  • DNF: sudo dnf install SDL3_ttf-devel -y (May not be ready. May have to compile from source)
For SDL_mixer it would be:
  • Pacman: sudo pacman --noconfirm -S sdl3_mixer
  • APT: sudo apt install libsdl3-mixer-dev -y (May not be ready. May have to compile from source)
  • Zypper: sudo zypper install -y SDL3_mixer-devel
  • DNF: sudo dnf install SDL3_mixer-devel -y (May not be ready. May have to compile from source)

3) Try to compile again and you'll get another error:
  • SDL3_image:
    g++ 02-textures-and-extension-libraries/02-textures-and-extension-libraries.cpp -lSDL3 -o 02-textures-and-extension-libraries.bin
    undefined reference to `IMG_Load'
  • SDL3_ttf:
    g++ 08-true-type-fonts/08-true-type-fonts.cpp -lSDL3 -o 08-true-type-fonts.bin
    undefined reference to `TTF_Init'
  • SDL3_mixer:
    g++ 15-sound-effects-and-music/15-sound-effects-and-music.cpp -lSDL3 -o 15-sound-effects-and-music.bin
    undefined reference to `MIX_Init'
Again, you can fix this with by linking against the extension library:
  • SDL3_image: g++ 02-textures-and-extension-libraries/02-textures-and-extension-libraries.cpp -lSDL3 -lSDL3_image -o 02-textures-and-extension-libraries.bin
  • SDL3_ttf: g++ 08-true-type-fonts/08-true-type-fonts.cpp -lSDL3 -lSDL3_image -lSDL3_ttf -o 08-true-type-fonts.bin
  • SDL3_mixer: g++ 15-sound-effects-and-music/15-sound-effects-and-music.cpp -lSDL3 -lSDL3_image -lSDL3_mixer -o 15-sound-effects-and-music.bin

At this point the application should run without issue:
  • SDL3_image: ./02-textures-and-extension-libraries.bin
  • SDL3_ttf: ./08-true-type-fonts.bin
  • SDL3_mixer: ./15-sound-effects-and-music.bin

Now that you have your extension library set up, you can move onto the second part of the tutorial.

Setting up SDL Extension Libraries From Source

Oh why did commit to supporting so many way to set up SDL?

Actually, setting up SDL libraries from source isn't that bad, for the most part (I'm looking at you again, RedHat). Most of the time it works fine, but when it doesn't prepare to spend a day chasing after those 2 or 3 commands to get everything working.

1) If you're just joining us, you first need to download a tutorial source code to test the SDL extension library installation:
  • SDL3_image: wget https://lazyfoo.net/tutorials/SDL3/02-textures-and-extension-libraries/02-textures-and-extension-libraries.zip
    unzip 02-textures-and-extension-libraries.zip
  • SDL3_ttf: wget https://lazyfoo.net/tutorials/SDL3/08-true-type-fonts/08-true-type-fonts.zip
    unzip 08-true-type-fonts.zip
  • SDL3_mixer: wget https://lazyfoo.net/tutorials/SDL3/15-sound-effects-and-music/15-sound-effects-and-music.zip
    unzip 15-sound-effects-and-music.zip
2) Now attempt to compile the code and you should get an error back:
  • SDL3_image:
    g++ 02-textures-and-extension-libraries/02-textures-and-extension-libraries.cpp -lSDL3 -o 02-textures-and-extension-libraries.bin
    fatal error: SDL3_image/SDL_image.h: No such file or directory
  • SDL3_ttf:
    g++ 08-true-type-fonts/08-true-type-fonts.cpp -lSDL3 -o 08-true-type-fonts.bin
    fatal error: SDL3_image/SDL_image.h: No such file or directory
  • SDL3_mixer:
    g++ 15-sound-effects-and-music/15-sound-effects-and-music.cpp -lSDL3 -o 15-sound-effects-and-music.bin
    fatal error: SDL3_mixer/SDL_mixer.h: No such file or directory
This is expected since the extension library is not installed.

3) Go to the release page for your library of choice: And download the source code, unzip it, and cd to the source directory. Remember that these are the version numbers at the time of writing and have likely changed so don't blindly copy/paste these commands:
  • SDL3_image:
    wget https://github.com/libsdl-org/SDL_image/archive/refs/tags/release-3.4.4.zip -O sdl3-image-release-3.4.4.zip
    unzip sdl3-image-release-3.4.4.zip
    cd SDL_image-release-3.4.4
  • SDL3_ttf:
    wget https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-3.2.2.zip -O sdl3-ttf-release-3.2.2.zip
    unzip sdl3-ttf-release-3.2.2.zip
    cd SDL_ttf-release-3.2.2 
  • SDL3_mixer:
    wget https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-3.2.4.zip -O sdl3-mixer-release-3.2.4.zip
    unzip sdl3-mixer-release-3.2.4.zip
    cd SDL_mixer-release-3.2.4
  • And yes, you can also pull the repo using Git, but I recommend using official releases as the latest branch may not be stable.

    4) Ideally, it only takes 4 commands to build and install an SDL extension library from source once you're in the source directory:
    • cmake -S . -B build Configure the build
    • cmake --build build Run the build
    • cd build Go into the build directory
    • sudo make install Install the library
    This assumes you have have all your dependency libraries installed, which you will most likely don't. So let's attempt to build and see what kind of errors we can run into. Attempt to run the CMake build configuration:
    cmake -S . -B build

    If this is your first time building from source, you may get a missing cmake error: Command 'cmake' not found
    Which can be fixed by installing cmake:
    • Pacman: sudo pacman --noconfirm -S cmake
    • APT: sudo apt install cmake -y
    • Zypper: sudo zypper install -y cmake
    • DNF: sudo dnf install cmake -y

    5) Attempt to run the CMake build configuration again (cmake -S . -B build) and you'll likely get some errors from missing dependencies depending on the library you're compiling and the distro you're using. Let's go through some errors you may encounter.

    Pacman for Arch Based Distros

    5) CatchyOS fortunately came with all dependencies installed, so you should be able to run the extentions installation without issue:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    APT for Debian Based Distros

    Apt for SDL_image

    5) If you installed SDL3, SDL3_image should install without issue:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    Apt for SDL_ttf

    5) Running the configuration (cmake -S . -B build) will likely get you a missing FreeType error:
    Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)

    You can fix this by installing FreeType: sudo apt install libfreetype6-dev -y

    Now the installation should work:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    Apt for SDL_mixer

    5) If you installed SDL3, SDL3_mixer should install without issue:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    Zypper for SuSE Based Distros

    Zypper for SDL_image

    5) If you installed SDL3, SDL3_image should install without issue:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    Zypper for SDL_ttf

    5) Running the configuration (cmake -S . -B build) will likely get you a missing FreeType error:
    Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)

    You can fix this by installing FreeType: sudo zypper install -y freetype2-devel

    Now the installation should work:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    Zypper for SDL_mixer

    5) If you installed SDL3, SDL3_mixer should install without issue:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    DNF for RedHat Based Distros

    DNF for SDL_image

    5) Running the configuration (cmake -S . -B build) will likely get you a missing zlib error:
    CMake Error at /usr/lib64/cmake/ZLIB/ZLIB.cmake:84 (message):
      The imported target "ZLIB::zlibstatic" references the file
    
         "/usr/lib64/libz.a"
    
      but this file does not exist.

    You can try to build/install zlib yourself if you want it, but for this tutorial you can just build SDL_image without it:
    cmake -S . -B build -DSDLIMAGE_ZLIB=OFF

    The the rest the build/installation should work:
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    DNF for SDL_ttf

    5) Running the configuration (cmake -S . -B build) will likely get you a missing FreeType error:
    Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)

    You can fix this by installing FreeType: sudo dnf install freetype-devel -y

    Now the installation should work:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    DNF for SDL_mixer

    5) If you installed SDL3, SDL3_mixer should install without issue:
    Run the build configuration: cmake -S . -B build
    Run the build: cmake --build build
    Go into the build directory: cd build
    Install the library: sudo make install

    With the SDL3 Extension Installed

    6) Return to your home directory (cd ~) and try to compile the test source code and you should get an error:
    • SDL3_image:
      g++ 02-textures-and-extension-libraries/02-textures-and-extension-libraries.cpp -lSDL3 -o 02-textures-and-extension-libraries.bin
      undefined reference to `IMG_Load'
    • SDL3_ttf:
      g++ 08-true-type-fonts/08-true-type-fonts.cpp -lSDL3 -o 08-true-type-fonts.bin
      undefined reference to `TTF_Init'
    • SDL3_mixer:
      g++ 15-sound-effects-and-music/15-sound-effects-and-music.cpp -lSDL3 -o 15-sound-effects-and-music.bin
      undefined reference to `MIX_Init'
    Again, you can fix this with by linking against the extension library:
    • SDL3_image:
      g++ 02-textures-and-extension-libraries/02-textures-and-extension-libraries.cpp -lSDL3 -lSDL3_image -o 02-textures-and-extension-libraries.bin
    • SDL3_ttf:
      g++ 08-true-type-fonts/08-true-type-fonts.cpp -lSDL3 -lSDL3_image -lSDL3_ttf -o 08-true-type-fonts.bin
    • SDL3_mixer:
      g++ 15-sound-effects-and-music/15-sound-effects-and-music.cpp -lSDL3 -lSDL3_image -lSDL3_mixer -o 15-sound-effects-and-music.bin
    7) Try to run the tutorial source:
    • SDL3_image:
      ./02-textures-and-extension-libraries.bin
    • SDL3_ttf:
      ./08-true-type-fonts.bin
    • SDL3_mixer:
      ./15-sound-effects-and-music.bin
    And you may run into the following error:
    • SDL3_image:
      error while loading shared libraries: libSDL3_image.so.0: cannot open shared object file: No such file or directory
    • SDL3_ttf:
      error while loading shared libraries: libSDL3_ttf.so.0: cannot open shared object file: No such file or directory
    • SDL3_mixer:
      error while loading shared libraries: libSDL3_mixer.so.0: cannot open shared object file: No such file or directory
    The above error about the missing so.0 file is because your distro can't find the library we compiled. To point it to the library we installed, we have to set the LD_LIBRARY_PATH variable.

    8) For Arch based distros running the Fish shell, this will update the variable globally and permanently:
    set -Ux LD_LIBRARY_PATH "$LD_LIBRARY_PATH:/usr/local/lib"

    For Apt based distros like Ubuntu:
    sudo vim /etc/environment   #Open up the global environment config file
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib   #Append the path to the libSDL3.so.0 file
    reboot   #Exit Vim and reboot to make it permanent
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib   #Or you can set the variable in your current shell to use it until your next reboot
    

    For Zypper based distros like OpenSuSE:
    sudo vim /etc/environment   #Open up the global environment config file
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Append the path to the libSDL3.so.0 file
    reboot   #Exit Vim and reboot to make it permanent
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Or you can set the variable in your current shell to use it until your next reboot
    

    For DNF based distros like CentOS:
    sudo vim /etc/environment   #Open up the global environment config file
    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Append the path to the libSDL3.so.0 file
    reboot   #Exit Vim and reboot to make it permanent
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib64/   #Or you can set the variable in your current shell to use it until your next reboot
    

    At this point the application should run without issue:
    • SDL3_image:
      ./02-textures-and-extension-libraries.bin
    • SDL3_ttf:
      ./08-true-type-fonts.bin
    • SDL3_mixer:
      ./15-sound-effects-and-music.bin

    Now that you have your extension library set up, you can move onto the second part of the tutorial.

    Addendum: Build Engineering

    I was only half joking about Linux from Scratch. A lot of my friends who are career sysadmins recommend doing a Linux from Scratch if you really want to learn Linux architecture.

    This thing we're doing where we're setting up things to compile is known as build engineering. Large companies will dedicate entire teams to this.

    Once you start dealing with large projects (like AAA games), the build process gets really gnarly. It's not a bad idea to start looking into build engineering because even things like how to structure your source control can make a significant impact on your project.