Skip to content

Instantly share code, notes, and snippets.

@Vinatorul
Last active November 17, 2024 18:27
Show Gist options
  • Save Vinatorul/4b3ca4c1b96c18b110db to your computer and use it in GitHub Desktop.
Save Vinatorul/4b3ca4c1b96c18b110db to your computer and use it in GitHub Desktop.
SDL2.0 for Ubuntu 12.4

Problem summary

Ubuntu 12.04 doesn't support SDL2.0 from "box" so here is a short instruction what to do, if you faced the same problem as me.

Installation

We will install SDL2.0 from sources. First of all we need to install dependencies (same as for SDL1.2) and mercurial:

$ sudo apt-get build-dep libsdl1.2-dev 
$ sudo apt-get install mercurial 

NOTE: build-dep will install only dependencies for libsdl1.2-dev, not the whole lib.

Now we need to get the latest version of libsdl2.0:

$ mkdir sdl_lib && cd sdl_lib 
$ hg clone https://hg.libsdl.org/SDL

Compile and install:

$ cd SDL 
$ mkdir build && cd build 
$ ../configure 
$ make 
$ sudo make install 

Now you can use SDL2.0 at your Ubuntu 12.04. Enjoy! ;)

Troubleshooting

I've got another problem:

error while loading shared libraries: libSDL2-2.0.so.0: cannot open shared object file: No such file or directory

Solution

I've found all SDL like libs

find /usr/ /usr/local/ /lib/ /etc/ /lib32/ /lib64/ -name *SDL*.so*

I've got:

/usr/lib/i386-linux-gnu/libSDL-1.2.so.0
/usr/lib/i386-linux-gnu/libSDL-1.2.so.0.11.3
/usr/local/lib/libSDL2-2.0.so.0
/usr/local/lib/libSDL2-2.0.so.0.4.0
/usr/local/lib/libSDL2.so
/usr/local/lib/libSDL2-2.0.so.0
/usr/local/lib/libSDL2-2.0.so.0.4.0
/usr/local/lib/libSDL2.so

So libs are in usr/local/lib dirs. Just add that path to LD_LIBRARY_PATH solve the problem:

export LD_LIBRARY_PATH=/lib:/usr/lib:/usr/local/lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment