Sol's Graphics for Beginners

01 - Setting Up SDL in Linux

(other platforms)

These instructions (by Larry Reznick) do not cover exactly everything that is covered by the other platform chapters, so you may wish to read through some other chapter as well.

Linux does not currently have a "preferred" IDE, so you may need to improvise a bit when the tutorial speaks about IDE tasks.

(If your distribution doesn't use RPMs, you may wish to try the same tasks with your distribution's package management system).

  • There may be an SDL library present on your Linux system in /usr/lib and header files in /usr/include/SDL. Chances are they're older than the latest stable release. You can check your SDL installation with "rpm -q SDL" or all possible variations with "rpm -qa | grep SDL". You may want to use rpm to remove this. I didn't need to.
  • Download the latest SDL tarfile. (I always install from source tarfiles, not RPMs.)
  • Change to the directory in which you want to extract the SDL source subdirectory.
  • Extract the data using tar, such as with "tar -xvzf SDL-1.2.8.tar.gz".
  • Change to the subdirectory just created for the SDL source.
  • Check the configure options using "./configure --help" and note any options relevant to your needs.
  • Run "configure" with any options needed.
  • Run "make" to build the software.
  • Switch to the root user and run "make install".
  • If /etc/ld.so.conf doesn't have "/usr/local/lib" in it, and no files exist in /etc/ld.so.conf.d, either add that "/usr/local/lib" line to the file, or write a /etc/ld.so.conf.d/local.conf file containing that "/usr/local/lib" line.
  • Run "ldconfig".
  • Enjoy SDL.

The tutorial assumes that you're using some kind of IDE, and that every chapter's project is in its own directory (starting from folder called ch01), and that there's a main source file called main.cpp.

After creating those, you are ready for 02 - SDL Skeleton and Putting Pixels..

Having problems? Try the forums!

Any comments etc. can be emailed to me.