Introduction to SDL2

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

本パッケージは LFS-11.1 において正しくビルドでき動作することが確認されています。

Package Information

  • Download (HTTP):

  • Download MD5 sum: 98b8a1535a757ea1d03ae44e2fb20247

  • Download size: 6.9 MB

  • Estimated disk space required: 132 MB (with docs)

  • Estimated build time: 0.4 SBU (using parallelism=4; with docs)

Additional Downloads

SDL2 Dependencies



ALSA-1.2.5, Doxygen-1.9.2 (to create documentation), ibus-1.5.25, NASM-2.15.05, PulseAudio-15.0, libsamplerate-0.2.2, X ウィンドウシステム, DirectFB, and fcitx

User Notes:

Installation of SDL2

First, if you are building on a 32-bit i686 system, apply a patch containing a fix for the OpenGL headers and their data types:

case $(uname -m) in
   i?86) patch -Np1 -i ../SDL2-2.0.16-opengl_include_fix-1.patch ;;

Install SDL2 by running the following commands:

./configure --prefix=/usr &&

If you have Doxygen-1.9.2 installed and want to build the html documentation, run the following commands:

pushd docs  &&
  doxygen   &&


If you wish to build and run the package regression tests, do not delete the static libraries below until after the tests are built.

Now, as the root user:

make install              &&
rm -v /usr/lib/libSDL2*.a

If you built the documentation, install it as the root user:

install -v -m755 -d        /usr/share/doc/SDL2-2.0.16/html &&
cp -Rv  docs/output/html/* /usr/share/doc/SDL2-2.0.16/html

Command Explanations

rm -v /usr/lib/libSDL2*.a: Normally static libraries can be disabled with a --disable-static option to configure, but that breaks the build in this package.

--disable-alsa-shared: This switch disables dynamically loading ALSA shared libraries.

--disable-sdl-dlopen: This switch disables using dlopen for shared object loading. Loading image backend libraries like libpng dynamically on the fly does not work.

--disable-x11-shared: This switch disables dynamically loading X11 shared libraries.

Configuring SDL2

Configuration Information

ライブラリのほとんどは、どこにインストールされているかを定める方法がないものです。 したがってインストールされるディレクトリがどこかを捉えておく必要があります。 つまり /etc/ ファイル内に /opt/lib とか /usr/local/lib といったディレクトリを記述する必要が出てきます。 これを行っておかないと ldd は共有ライブラリを見つけ出すことができません。 上の設定が必要であったなら、それを実施した上で root ユーザーでログインし /sbin/ldconfig を実行してください。


Installed Program: sdl2-config
Installed Libraries:
Installed Directories: /usr/include/SDL2 and /usr/share/doc/SDL-2.0.16

Short Descriptions


determines the compile and linker flags that should be used to compile and link programs that use libSDL2

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