Compiling software

From LXF Wiki

Introduction

OK, so this section is all about compiling your own software. 'Why the chuff would I want to do that?' you might well ask. Well if you're running one of those RPM or APT based distros (Red Hat, Mandriva, Debian etc.) you'll be used to installing your software by installing a package.

That's all well and good, but sometimes you might want the newest version of a piece of software, which your distribution provider may not have packaged up for you. Or it might be a piece of software that your distro doesn't include as default.

If any of the above things happen to be true, then carry on reading this little guide...

Table of contents

Tools

There are some basic tools that you'll need to complete this process.

  • GCC - this is the compiler which will make text files into magic programs to do stuff (this will be provided by your distro and is probably installed - type 'gcc' at the command prompt to check)
  • Make - this is a clever little utility that allows code monkeys to set the order GCC builds stuff in (this will be provided by your distro - type make at the command prompt to check)
  • tar - this is like an unzip utility for anything with either a .tar or .tar.gz extension (this will be provided by your distro but may not be installed by default - type tar at the command prompt to check)

How it's Done

OK, the basic recipe for compiling stuff yourself is this:

tar -xfv [downloaded file name]
    • If the extension is .tar.gz use
tar -xzfv [downloaded file name]
    • If the extension is .tar.bz use
tar -xjfv [downloaded file name]
  • go into the directory and run the provided configure script
cd [file directory]
./configure   ("./" references the current working directory)
  • watch the output closely; if it fails it's probably asking for another package to be installed, so do that and repeat this step.
  • type make - this will compile the program, and this is the longest step - go get some tea and biscuits
make
  • if that all worked then become the root user
su (followed by enter, then type the root password)
  • now type:
make install (this will install the program so you can run it like the user you are! Joy!)

What if it all goes to the dogs?

Well it could be that there's a problem with the code, or it could be something else. The best place to go at this point is to the website of the people who wrote the software, as they're likely to have some support forums where you can get help, or at least make friends with other people in your situation.

Sometimes they offer developer and stable version of the software. If the dev version fails try the stable.

Using CVS

Some developers allow access the their CVS repositories. This means you can download the very latest version of the code, which may be full of amazingly brilliant features, but also may not compile or work.

Sourceforge projects provide access to all hosted projects CVS repositories, the general method is shown here:

Login to the CVS server:

cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/[project name] login

Get a copy of the code:

cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/[project name] co -P modulename


That's about it - enjoy your slightly more up-to-date software :D

--Bluemonki 21:22, 3 Nov 2005 (GMT)