Datasheet
After make completes, your shell prompt is displayed. If no error messages were encountered during the
building process, you can test the Lua interpreter by executing the following command:
make test
That should result in output that looks like
Hello world, from Lua 5.1!
In the unlikely event that you don’t get this response, the probable culprit is the unavailability of one or
more runtime libraries. Although the Lua internals are statically linked into
lua, other libraries are
expected to be available for dynamic linking when
lua is actually run. These runtime dependencies
include the math library, the general purpose C library, and, depending on your platform, libraries that
support screen formatting and text input editing and recall. List the shared library dependencies with
the following
ldd command:
ldd src/lua
The result is a series of lines such as this:
libm.so.6 => /lib/libm.so.6 (0x40024000
libdl.so.2 => /lib/libdl.so.2 (0x40047000)
If, in the output, you see one or more “not found” lines such as the following, you’ll know that the refer-
enced library is not present on your system or that the dynamic loader is unable to find it:
libncurses.so.5 => not found
In this case, consult your operating system documentation to guide you through the process of installing
the missing library. Alternatively, you can rebuild
lua with fewer dependencies with the command make
clean generic
.
If you have root privileges on your system and would like
lua and luac to be available for other users,
you should become root at this point. Do this with the following command:
su –
Alternatively, you can use the sudo command to elevate your privilege level for particular commands.
In this case, prefix the command requiring root authority with
sudo. In general, using sudo requires
some configuration using the
visudo command.
The hyphen tells the command that you want the root’s environment, including its search paths, to be
loaded. Doing so will likely change your default working directory, so you may need to return to the
lua directory by using the cd command. For example:
cd /usr/local/src/lua-5.1.1
10
Chapter 1: Getting Situated
04_069172 ch01.qxp 1/2/07 7:53 PM Page 10