Adventures in Compiling Open Source Software

I first downloaded the zipped files “less” and “wget” using links from the GNU software collection website. I started with building the package “less” using the following commands:

root@LoneWolf:MakeTest# dir
less-418  less-418.tar.gz  wget-latest.tar.gz

Untar the files from the zipped archive:
root@LoneWolf:MakeTest# tar -xvzf less-418.tar.gz

Change to the unzipped directory.
root@LoneWolf:MakeTest# cd less-418

Run the “configure” script:
root@LoneWolf:less-418# ./configure

Run the “make” command:
root@LoneWolf:less-418# make

See how long it took for the “make” command to execute:
root@LoneWolf:less-418# time make
make: Nothing to be done for `all’.

real    0m0.005s
user    0m0.004s
sys    0m0.001s

Test the command by executing the binary file:
root@LoneWolf:less-418# ./less README

The program compiled without errors or dependencies and the binary executed as expected.

I then tried to build the “wget” package, but it required the dependency “Libidn”.
Change back to the directory where the downloaded zipped archives reside:
root@LoneWolf:less-418# cd ../
root@LoneWolf:MakeTest# dir
less-418  less-418.tar.gz  wget-latest.tar.gz

Untar the “wget” archive:
root@LoneWolf:MakeTest# tar -xvzf wget-latest.tar.gz
root@LoneWolf:MakeTest# dir
less-418  less-418.tar.gz  wget-1.12  wget-latest.tar.gz

Change to the untarred directory:
root@LoneWolf:MakeTest# cd wget-1.12/

Run the configure script:
root@LoneWolf:wget-1.12# ./configure

I received the following error for a missing shared library file:
configure: WARNING: Libidn not found

I opted to pick another package, and downloaded the file “gawk”.
root@LoneWolf:wget-1.12# cd ../
root@LoneWolf:MakeTest# wget http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz
–2011-01-13 13:05:36–  http://ftp.gnu.org/gnu/gawk/gawk-3.1.8.tar.gz
Resolving ftp.gnu.org… 140.186.70.20
Connecting to ftp.gnu.org|140.186.70.20|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 2627635 (2.5M) [application/x-gzip]
Saving to: “gawk-3.1.8.tar.gz.1”

100%[======================================>] 2,627,635   1.59M/s   in 1.6s

2011-01-13 13:05:37 (1.59 MB/s) – “gawk-3.1.8.tar.gz.1” saved [2627635/2627635]

I untarred the archive:
root@LoneWolf:MakeTest# tar -xvzf gawk-3.1.8.tar.gz.1

Changed to the untarred directory:
root@LoneWolf:MakeTest# cd gawk-3.1.8

Ran the “configure” script:
root@LoneWolf:gawk-3.1.8# ./configure

This time I was successful in having no errors or dependencies, so I ran the “make” command.
root@LoneWolf:gawk-3.1.8# make

Checked to see how much time it took to run “make”:
root@LoneWolf:gawk-3.1.8# time make
real    0m0.107s
user    0m0.051s
sys    0m0.046s

I then tested the command by running the binary:
root@LoneWolf:gawk-3.1.8# ./gawk ‘END{print NR}’ README
114

It showed that there are 114 lines in gawk’s “README” file.

Manually configuring programs from tarballs is a time consuming process, but is sometimes necessary in situations where there is no other alternative, such as having a ready-made package that a package manager can install for you. Resolving dependencies can be a real challenge if there are many extra files that are required by the software that you are trying to compile. Compiling from source code is not for the impatient!
The next step is to create RPM files  from the two zipped archives for “list” and “gawk”. This procedure is outlined in my RPM-Writing Lab blog post.

Advertisements

About gr8can8dian

Certified Linux geek.
This entry was posted in SBR600. Bookmark the permalink.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s