Compiling and installing Linux software

One of the regularly highlighted features of Linux is its open source heritage. Linux, and most of the software available for it, is distributed as source code. This source code needs to be compiled to machine code before it can be run on your computer. In this month's Here's How column, we look at the steps involved in compiling and installing software.

BENEFITS

It is possible to get most of the software you will need in binary form. Programs in binary form usually come packaged as RPMs and are tailored for particular distributions of Linux. Compiling a program from source has several advantages:

  • The program will be built and optimised for your particular system;
  • There are often many configuration options available at compile time that are not available with software distributed as a binary;
  • More programs are available; in particular, most pre-release software is not available in binary form;
  • Many programs distributed in binary form may not be available for your distribution. Distributing software in source form ensures that the program will work on any distribution.

There are several steps involved in compiling and installing software, but it's not very hard to perform once you've done it once or twice. You will need development tools installed on your system; all distributions include them. This column is only a generic guide and these instructions may not work for all programs, but they will work without modification for most popular programs. When in doubt, consult the documentation for the program in question.

CONFIGURATION

The first step in compiling a program is to configure it. Before performing the actual configuration, you should first read the documentation for the program. In the directory containing the source code there are likely to be files called README and INSTALL. Read them to determine whether this program has any particular requirements, and for general help if you encounter problems during installation.

Next, configure the build process. In the directory that contains the source code, type:

$ ./configure --help

This will return a list of all the configuration options available for the build process. Generally, the default configuration options are suitable for most systems. Many of these options will allow you to disable features that you may not want or that may be causing problems when compiling the program. Take note of any configuration options you would like to use and then configure the build process by typing:

$./configure <configuration options>where <configuration options> are all of the options you have decided to use. The configure program will now perform a series of tests on your system to check that it will be possible to build the program. Some errors may occur; they usually mean you will need to install another piece of software to build the program. The configure program will provide some information on what is missing, and you must find and install these programs before you can continue the build process. If there are no errors, the build is properly configured and it is time to compile.

COMPILING

Now that the hard part is out of the way, compile the program by typing:

$ make

Compiling a program will take several minutes, at minimum, though it could take several hours depending on the size of the program and the speed of your system. The screen will slowly update as each piece of source code is compiled. When all are compiled they will be linked together to form the program.

If errors occur during compilation there is little you can do unless you know the programming language in which the program was written. If compilation fails, you can try using other configuration options or another version of the program.

INSTALLING

Now that you have a properly built program, install it. As root, type:

# make install

This will make any directories needed on your computer and install the program in them. When this process is complete, you should be able to run the program by typing its name at the prompt. When you are happy that the program works properly, you can delete the directory the source code is in and continue to use the program.

Join the PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Alastair Cousins

PC World
Show Comments

Essentials

Lexar® JumpDrive® S57 USB 3.0 flash drive

Learn more >

Microsoft L5V-00027 Sculpt Ergonomic Keyboard Desktop

Learn more >

Mobile

Lexar® JumpDrive® S45 USB 3.0 flash drive 

Learn more >

Exec

HD Pan/Tilt Wi-Fi Camera with Night Vision NC450

Learn more >

Audio-Technica ATH-ANC70 Noise Cancelling Headphones

Learn more >

Lexar® JumpDrive® C20c USB Type-C flash drive 

Learn more >

Lexar® Professional 1800x microSDHC™/microSDXC™ UHS-II cards 

Learn more >

Budget

Back To Business Guide

Click for more ›

Most Popular Reviews

Latest News Articles

Resources

GGG Evaluation Team

Michael Hargreaves

Windows 10 for Business / Dell XPS

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Kathy Cassidy

STYLISTIC Q702

First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni

STYLISTIC Q572

For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?