How to build from source code in GNU/Linux

Most repositories for many GNU/Linux distributions have mass amounts of software and packages available within them; it’s becoming more and more rare you are required to build anything from source (unless you use Gentoo), however, many users are left unaware of how to do so if the need ever arises.

This tutorial will show you from beginning to end, how it’s done. I use Arch Linux, so little quirks may arise that are slightly different from distributions like Ubuntu, but the process is nearly identical, except when fulfilling dependencies comes into play.

Note: This tutorial will be done almost entirely within the command line, so be prepared to get your hands a little dirty and have a terminal window open!

We are going to build Pidgin, from source. Pidgin is a popular multi-protocol chat client, used to connect to multiple different chats at once, such as Skype and Facebook Messenger (There is an article here on Ghacks, showing how to connect to those very two)

Pidgin is available in most distribution repositories, but I thought we would build it, since it’s simple, easily done, and won’t get super complicated for your first time building.

Pidgin Source

Step 1: Download the source

First thing we need to do, is get our sourcefiles! You can grab them from here.

Once those are downloaded, pop open your terminal and navigate to your Downloads folder (or wherever you downloaded that tarball to)

  • cd /Downloads

Next, we need to unpackage the archive, we do this via the ‘tar’ command

  • tar -xf pidgin-2.12.0.tar.bz2

Note:

  • the -x tells tar to extract the file

  • the f tells tar to read the archive content from a file, like our pidgin-2.12.0.tar.bz2

next, we cd into the directory

  • cd pidgin-2.12.0/

Next, we need to configure the source code for our machine, and ensure that we have all the necessary dependencies required to build the source.

Typically this is done simply by typing ./configure, however, I know that pidgin is going to error if you do that because most distributions do not have the necessary packages to compile two parts of Pidgin: required for TCL support (an older programming language rarely used anymore), as well as packages needed to support ‘meanwhile’, which is needed for using Pidgin with “Sametime,” an IBM instant messaging service/product.

So, unless you specifically need support for TCL or Sametime, we are going to tell our system to disable building those packages into Pidgin, therefore bypassing our need to fulfill those requirements to configure the application!

  • ./configure –disable-meanwhile –disable-tcl

if everything goes well (as it did on my very minimal Arch Linux install, so users of more robust distributions also ‘shouldn’t’ run into issues), you’ll get a bunch of scrolling text on the screen, eventually telling you:

configure complete, now type ‘make’

…Which is exactly what we do next

You’re going to see a whole bunch of text absolutely flood your terminal at this point. You on the other hand are going to go get a coffee, walk the dog, or post that image on social media you’ve been wanting to post and kept putting off; this is going to take a few minutes (it took around 5 minutes or so on my laptop)

Once that’s finally finished, the last step is to install Pidgin!

  • sudo make install

When the wall of text is finished, so are you!

Note: I had to log out and back in, before Pidgin showed up in my applications menu. If you don’t see it, try that.

To sum it up:

  1. Download the source file and extract it.
  2. Run ./configure
  3. Run make
  4. Run sudo make install

Final Words

That’s it! That is the basics of compiling applications from source. Some applications are done a little differently, but that is another topic for another day; you’ll find this process is the same for many, many programs. So, enjoy!

Summary

Article Name

How to build from source code in GNU/Linux

Description

Mike explains how to build a software program from source on GNU/Linux devices. He uses Pidgin as an example, and walks you through all steps.

Author

Mike Turcotte

Publisher

Ghacks Technology News

Logo

Powered by WPeMatico

eBay