How Do I Compile an Application?

When a distribution package is not available, the source code is always available to compile with Open Source applications. Compilation is the process of converting programming code into a program that you can run and use. Although it sounds like a devilishly difficult process, it is typically fairly simple.

You should first have a look on the application's Web page, or in the INSTALL or README file that is included with the code to see what software the application needs to run. When you know what is required, use Synaptic to search for the required tools. Many of the requirements will be software libraries (software that applications require to run), and these libraries typically have "lib" at the start of the package name. As an example, if you need to have the Vorbis audio codec installed, do a search in Synaptic for Vorbis, and libvorbis will be one of the packages. You should also install with -dev at the end of the package name (such as libvorbis-dev). These packages allow you to compile software for that library.

The process of compiling software involves three steps: 1) configuration, 2) compilation, and 3) installation. Open a terminal, move into the directory from which you extracted the source code, and configure it:

foo@bar:yourapp$ ./configure

When you run ./configure, it checks to see that you have all the required software. If it throws an error, it is likely that a required tool or library is missing. Find out what it is, and install it. Typically, configure will tell you what you need to install.

If the configure script works fine, compile the code with this command:

foo@bar:yourapp$ make

If a problem appears when compiling the software, it may be a bug or problem in the source code. It is best to refer your problem to the author of the code for further help.
If the compile process was successful, install the application with this command:

foo@bar:yourapp$ sudo make install

The software is now fully installed.

Quick Tip

If you want to ensure you have all the right tools installed to build your application, run the following command:

foo@bar:~$ sudo apt-get build-dep packagename