Aerospace



Home

Company Information

Information Request

Linux How-to Guides

ADSP 21xx
Digital Signal Processing
Tutorials

SW Utilities

On-line Order Form

Aerospace Projects

Commercial Projects

Circuit Boards

Server Support


Bonk

Have you found this site useful? Did we save you time? Did we cure your head-ache? Is your hair growing back now?

Please make a donation to help with maintenance.


Software Compile Howto

For Mandriva 10.2LE, 2005

Copyright 2005, Aerospace Software Ltd., GPL.


Scope

In general, there are two ways to install programs: Pre-packaged programs for your distribution, or compile from source yourself.

Obviously, the way to start is by using pre-packaged software and you should always look for that first. However, you should not be scared of installing from source. All you need is the True Geek Secret Tools: A box of doughnuts and a very large mug of coffee...

Note that you usually have to compile the kernel first, before you can compile anything else - see another howto on that topic.


The Steps

The install from source process comprises four steps:

  • Unpack the source code
  • Configure the source code
  • Compile and link the source code
  • Install the program

Therefore, until you get to step 4, no changes are made to your system and you can repeat steps 1 to 3 as many times as required, without fear of messing something up.


1. Source Code

The source code is usually distributed as a compressed archive. This archive is usually in one of two forms:

  • A gzip compressed tarball
  • A bzip compressed tarball

The way to uncompress a tarball is as follows:

  • Download the tarball to your user home directory, say /home/jdoe
  • If the filename ends with .tgz (shortform) or .tar.gz (longform), unzip it with gzip:
    $ tar -zxvf program-1.2.3.tgz
  • If the filename ends with .bz2 then unzip it like this:
    $ tar -jxvf program-1.2.3.bz2

A tarball is usually an archive of a directory and you will end up with something like:
/home/jdoe/program-1.2.3


README and INSTALL

So, move to that directory and start reading. Look for a file called README or some such and read it:

$ cd program-1.2.3
$ less README

Also look for a file called INSTALL or similar and read it:

$ less INSTALL

The INSTALL file will tell you exactly what to do.

Nine times out of ten, the instructions will amount to the following:

./configure
make
make install

The other ten percent of the time, you may have to spend some effort reading and you may have a long install method, but this is rare. If you are new to it, you may want to avoid these cases - rather go back to sourceforge and look for a simpler program.


2. Configuration

This is usually very simple:

$ ./configure

This process should end without errors about missing programs or libraries. If it needs a library, first look for it on your Mandrake CDs. Sometimes, you may have to visit the project page of the library concerned and get the latest version, then download, configure and install it first. With very complicated programs, you may have to do this two or three times, to get all the libraries you need.

It is an iterative process, but usually, it is not so bad.


3. Compile

This is just as simple. Provided that the configuration worked:

$ make

It should end without errors. If there are errors at this stage, they will be more difficult to fix than at the previous stage. Some errors can be fixed by changing the configuration.

You may have to go back to the previous step and do something like (random example):

$ make clean
$ ./configure --with-mysql=/usr/local/mysql

or whatever - read the INSTALL file carefully. The 'make clean' blows the previous make attempt away and allows you to configure and make everything all over again.


4. Install

Provided that the make process completed error free, you can install the program and its manual pages. This is usually:

$ su
superuserpasword
# make install

Now the only remaining problem is where is the program? How do you run it? Well, read the INSTALL file and try something like this:

$ whereis programname
$ programname

The program will usually end up in /usr/local and sometimes in /opt.

Once you can run it, you can add an application link to a menu or to your desktop using Konqueror or simply do a right click on the desktop to get a menu to make a link to the application.

The bottom line is, don't give up too easily and read all the manuals and if the manuals are confusing, use Google...


Master Class - RPMs

While we are on the compile topic, note that whenever you make and install software from source, it is actually a good idea to compile the programs to RPMs, since then you are able to easily remove them again, if you have to.

Making RPMs used to be a black art, steeped in mystery, but thanks to a utility called checkinstall the voodoo is no more. Get checkinstall here: http://asic-linux.com.mx/~izto/checkinstall/

Using checkinstall, the method to make an RPM is extremely simple, but it doesn't always work - certainly worth a try though:

# ./configure
# make
# checkinstall

The result is a simple RPM file, which can then be installed with:

# rpm -i whateveritis 

RPMs created with Checkinstall are good for personal use, but not clean enough for public distribution. See another one of my guides for making good RPMs.


La voila!



Copyright © 2005-2008, Aerospace Software Ltd., GPL.