Compile Open Source Software from Source

Open source applications are free to download, but if you’re a real geek you might want to try compiling from source.


A compile session running on Mac OS X

Why would you care about compiling when you can download a pre-packaged, ready-to-go version of a program? One advantage that proponents of compiling claim is a speed boost. I haven’t been able to notice any significant differences between the conventional and hand-rolled versions I’ve made, so this might be just an example of the placebo effect. But it is possible by compiling to get a version of a program optimized for your particular machine.

A more tangible benefit of compiling is to get access to special features that were left out of a standard version by the people who put together a standard version such as a Debian/Ubuntu package. Newer versions also come out in source form, and it takes a while for Linux distros to incorporate new releases. If you absolutely have to have a new feature or just like to live on the bleeding edge, compiling must be for you. If you know how to code, you can actually modify the program and the open source licenses allow you to contribute your changes back to the community.

There are a couple of downsides, however. First, compiling can take a lot of time for big projects, like the X Window System. This is why distros based on compiliation, such as Gentoo, still offer binary packages. Also, compiling by hands means you have to have certain programs or libraries installed, called dependencies. Those dependencies have dependencies as well, leading to “Dependency hell.” Gentoo, the APT system used in Debian and Ubuntu, and Yum allow to to have all the benefits of compilation while still meanaging the dependencies for you.

So how do you get started? First, you’ll have to have the right tools: a C compiler (most open source apps are still written in it), the libraries, and other utilities. If you’re running a Unix or Linux system, you might have these installed already. Just type “gcc” and see what happens. If not, you’ll have to install a package like “build-essential” on Debian and Ubuntu, or XCode on a Mac. If you’re using Windows, you can install DJGPP or Cygwin, A Unix-like environment for Windows that includes a C compiler.

To actually compile a program on a Unix-ish system, go to a project Web site to download the package. Then you’ll have to unpack it using tar. The usual method is ‘tar -xzvf foo.tar.gz.’ This creates a directory called “foo” that you can enter. Once you’re there, you’ll usually type “./configure” to run a script that will figure out what kind of system you have and adjust the program accordingly, then “make” to actually compile, and “make install” to install it. Or more likely, get an error. This is why compiling is recommended for advanced users only.

All of the programs listed in 6 Best Text-Only Applications are available in source form, so you can practice your compiling on them, and if you’re looking for a speed boost, consider using Linux on an old computer.