Also, even if you just add extra libraries to your system, you must update ld.so.cache to reflect the presence of the new libraries.
5.3.4. Finding Out What Libraries a Game Depends On
Most commercial Linux games will be dynamically linked against various LGPL libraries, such as OpenAL or SDL. For these examples, Bioware's NeverWinter Nights <http://nwn.bioware.com > will be used.
To find out what libraries a game uses, we can use the "ldd " command. Cd to /usr/games/nwn , or wherever you installed it and take a look at the files. You should see a file called nwmain ; this is the actual game binary. Type "ldd nwmain " and you'll see:
$ ldd nwmain
linux-gate.so.1 => (0xffffe000)
libm.so.6 => /lib/libm.so.6 (0x40027000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40049000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x4009b000)
libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x40103000)
libmss.so.6 => not found
libSDL-1.2.so.0 => /usr/lib/libSDL-1.2.so.0 (0x40178000)
libc.so.6 => /lib/libc.so.6 (0x401ff000)
/lib/ld-linux.so.2 (0x40000000)
libGLcore.so.1 => /usr/lib/libGLcore.so.1 (0x40319000)
libnvidia-tls.so.1 => /usr/lib/libnvidia-tls.so.1 (0x409f1000)
libXext.so.6 => /usr/X11R6/lib/libXext.so.6 (0x409f3000)
libX11.so.6 => /usr/X11R6/lib/libX11.so.6 (0x40a01000)
libdl.so.2 => /lib/libdl.so.2 (0x40acd000)
libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x40ad1000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x40b88000)
libasound.so.2 => /usr/lib/./libasound.so.2 (0x40b90000)
ldd shows all the libraries a dynamic executable relies on, and shows you where they are. It also "pulls in" the dependencies of the dependencies. For instance, while NWN does not itself depend on libnvidia-tls.so , the Nvidia supplied libGL on my system does.
Missing libraries?
In the example above, we can see that nwmain wants libmss.so.6 , and the linker cannot find it. Usually, a missing library is a crash waiting to happen. There is one other thing to consider though: The majority of games are actually launched by a "wrapper", a shell script that performs some magic prior to launching the game. In the case of NWN, the wrapper is called nwn . Let's take a look at that now:
$ less nwn
#!/bin/sh
# This script runs Neverwinter Nights from the current directory
export SDL_MOUSE_RELATIVE=0
export SDL_VIDEO_X11_DGAMOUSE=0
# If you do not wish to use the SDL library included in the package, remove
# ./lib from LD_LIBRARY_PATH
export LD_LIBRARY_PATH=./lib:./miles:$LD_LIBRARY_PATH
./nwmain $@
This script sets up some environment variables, then launches the game binary with whatever command line options we added. The relevant part here is the environment variable called "LD_LIBRARY_PATH". This is a way of adding to the linkers search path. Try copying the line to your shell and seeing what happens when you re-run ldd.
$ export LD_LIBRARY_PATH=./lib:./miles:$LD_LIBRARY_PATH
$ ldd nwmain
linux-gate.so.1 => (0xffffe000)
libm.so.6 => /lib/libm.so.6 (0x40027000)
libpthread.so.0 => /lib/libpthread.so.0 (0x40049000)
libGL.so.1 => /usr/lib/libGL.so.1 (0x4009b000)
libGLU.so.1 => /usr/X11R6/lib/libGLU.so.1 (0x40103000)
libmss.so.6 => ./miles/libmss.so.6 (0x40178000)
libSDL-1.2.so.0 => ./lib/libSDL-1.2.so.0 (0x401ec000)
libc.so.6 =>

