How-To Session: Compiling Software From Source Code


Out of request I am going to cover a topic often overlooked by many in their first Linux baby steps: compiling from source. I will do this in the most general sense, even if there is great community repos and tools like Yaourt for Arch Linux that installs source from the User repository and ABS, their source compiling package tool. It will be relatively short but hey, source can be confusing to some people.

Learning to unpack that tar ball!!!

Most source packages will come in simple tar.gz packages so, lets go over how to extract things: (all of which is done in Terminal)

  • tar -zxvf file.tar.gz
  • tar -zxvf file.tgz
  • tar-jxvf
  • tar -xvf file.tar
  • gunzip file.gz
  • tar jxf file.tar.bz2
  • tar jxf file.tbz2

Getting your hands dirty:

Now we are going to go over the basic syntax of compiling from source:

  • extract your package with the tar command
  • ./configure
  • make
  • make install
  • make clean

Some packages don’t follow this simple syntax, and you sadly can’t blame them as there is no official standard for compiling from source. The above is just a guideline.

Some other things to know:

Uninstalling a source program:

  • If you didn’t delete your Makefile, I hope not! you may be able to remove the program by doing a make uninstall like so:
  • in Terminal type “make uninstall” in the SAME directory that you compiled the package from
  • ALWAYS,ALWAYS, ALWAYS, check for dependencies on the website where you downloaded the archive file BEFORE you compile it. I can’t tell you how many times I have been asked why something isn’t compiling, and that is the answer.
  • As some programs do not have a “standard” syntax like above in the tutorial, search the website, especially on the page where you got it, for instructions, it make just be a .run file or something easy that you didn’t see at first

If you have any comments/suggestions PLEASE comment this post or use the “Contact Us” page at the top of the site. I would like to thank you for reading this entry and hope you return.




About professorkaos64

Posted on 20090413, in How-To, Terminal and tagged , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s