SDL3-3.4.16

#### Beyond Linux® From Scratch (System V Edition) - Version r13.1-84

### Chapter 42. Multimedia Libraries and Drivers

- Prev

  sdl2-compat-2.32.72

- Next

  sound-theme-freedesktop-0.8

- Up
- Home

# SDL3-3.4.16

## Introduction to SDL3

The Simple DirectMedia Layer Version 3 (SDL3 for short) is a cross-platform library designed to make it easy to write multimedia software, such as games and emulators.

### Note

Development versions of BLFS may not build or run some packages properly if LFS or dependencies have been updated since the most recent stable versions of the books.

### Package Information

- Download (HTTP): https://www.libsdl.org/release/SDL3-3.4.16.tar.gz

- Download MD5 sum: 77e65a03b98e3f3227decd40261f47bd

- Download size: 15 MB

- Estimated disk space required: 121 MB (add 106 MB for tests)

- Estimated build time: 0.3 SBU (Using parallelism=4; add 0.3 SBU for tests)

### Additional Downloads

- Required patch: https://www.linuxfromscratch.org/patches/blfs/svn/SDL3-3.4.16-upstream_fixes-1.patch

### SDL3 Dependencies

#### Required

CMake-4.4.3

#### Recommended

alsa-lib-1.2.16.1, libusb-1.0.30, libxkbcommon-1.13.2, Mesa-26.1.7, pipewire-1.6.8, PulseAudio-17.0, Vulkan-Loader-1.4.357.0, wayland-protocols-1.49, and Xorg Libraries (if those are not present, the corresponding modules are not built)

#### Optional

ibus-1.5.34, jack, and sndio

## Installation of SDL3

Fix potential conflicts with `getresuid` by applying a patch:

    patch -Np1 -i ../SDL3-3.4.16-upstream_fixes-1.patch

Install SDL3 by running the following commands:

    mkdir build &&
    cd    build &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr \
          -D CMAKE_BUILD_TYPE=Release  \
          -D SDL_TEST_LIBRARY=OFF      \
          -D SDL_STATIC=OFF            \
          -D SDL_RPATH=OFF             \
          -W no-author -G Ninja ..     &&

    ninja

Now, as the `root` user:

    ninja install

## Testing SDL3

If you want to build the tests, issue the following commands:

    mkdir ../build-tests &&
    cd    ../build-tests &&

    cmake -D CMAKE_INSTALL_PREFIX=/usr \
          -D CMAKE_BUILD_TYPE=Release  \
          -D SDL_STATIC=OFF            \
          -D SDL_RPATH=OFF             \
          -D SDL_TESTS=ON              \
          -D SDL_INSTALL_TESTS=ON      \
          -W no-author -G Ninja ..     &&

    ninja &&
    DESTDIR=$PWD/TESTS ninja install

Now you will be able to run the tests in `TESTS/usr/libexec/installed-tests/SDL3`. You will have to run the tests individually. Some of them may need to be manually killed and audio will need to be working so that you can hear from the default audio output.

## Command Explanations

`-D SDL_TEST_LIBRARY=OFF`: This parameter disables building an unnecessary static library meant for the tests. It gets built in the testing section.

`-D SDL_STATIC=OFF`: This parameter disables building static libraries.

`-D SDL_RPATH=OFF`: This parameter disables installing with rpath. It can cause security issues otherwise.

## Contents

Installed Program: None
Installed Libraries: libSDL3.so
Installed Directories: /usr/include/SDL3 and /usr/lib/cmake/SDL3

### Short Descriptions

`libSDL3.so` | contains functions that provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and the 2D frame buffer across multiple platforms

- Prev

  sdl2-compat-2.32.72

- Next

  sound-theme-freedesktop-0.8

- Up
- Home