Compiling from source is the only way to use a lot of free software that your Linux package manager can't find, ready for download, in an Internet repository. Thankfully, compiling is often much easier than you may think.
In this post, I'll explain the most common way to install from sources on Linux -- suggesting, as a practical example, that you may replicate on your computer an actual compilation of the AbiWord 3.0 word processor on a Fedora 17 x86_64 box. My explanation is valid on most other distributions, as long as you change the "yum" parts with equivalent invocations of their package manager. Also, remember that only "yum" and (if installing to system folders) "make install" should be ran as root, and use your normal account for all the other steps.
What does compilation and installation mean?
A "software program" is a sequence of executable instructions in binary format for a microprocessor. The file containing those instructions is usually called the "binary" or "executable" of that program.
Software developers normally write source code or models in higher-level languages that are much easier to write and debug than binaries. The translation from source to binary, which includes its integration with third-party software libraries and similar stuff, is called compilation. Its results must be installed or (among other things) placed in folders where all users can find them, added to system menus, and so on.
This process begins downloading the right source code archive on your computer, unpacking it in some temporary folder and going into the subfolder that's created as result. For AbiWord 3.0.0, this means typing the following string into a terminal:
#> mkdir ~/abi3 #> cd ~/abi3 #> wget http://abisource.com/downloads/abiword/3.0.0/source/abiword-3.0.0.tar.gz #> tar xf abiword-3.0.0.tar.gz #> cd abiword-3.0.0
At this point, the first thing you should do is carefully read the advice and instructions in the README and/or INSTALL files that are usually distributed with the source code. After that, the standard minimum procedure on Linux consists of the three steps described below, plus the final removal of the source code to save space on your drive.
Time to configure
The configure shell script that's distributed with the sources looks at your computer, checks if it already contains all the pieces needed to compile, and generates the instructions to actually do it.
You may run the script as-is to create the simplest and smallest possible version of AbiWord:
or with the options it lists when it's launched with the -help switch:
#> ./configure --help | more
In my case, I added clip art, templates, and lots of plugins to the basic installation:
./configure --enable-clipart --enable-templates --enable-plugins="rsvg s5 hrtext pdf goffice openxml babelfish iscii passepartout psion hancom mswrite paint garble collab mathview opendocument pdb docbook clarisworks gda ots wikipedia wml command opml wmf loadbindings epub latex eml bmp wpg applix aiksaurus wordperfect gdict mht openwriter mif urldict presentation sdw freetranslation xslfo kword gimp google grammar"
The output of a "configure" script is very verbose. You can ignore most of it, except when it aborts with errors similar to this:
configure: error: Package requirements ( libots-1 >= 0.5.0 ) were not met: No package 'libots-1' found
This simply means that there is no version of "libots," whatever that is, already installed on the computer. No big deal. When that happens, search for "ots" (as "libots" may mean "libraries for ots") in the online software repositories of your distribution. The command for yum-based systems like Fedora is yum search <string> and the kind of results it gives for ots is very common (only relevant results are listed here):
#> yum search ots ... ots-libs.x86_64 : Shared libraries for ots ots.x86_64 : A text summarizer ots-devel.x86_64 : Libraries and include files for developing with libots
The actual extra software that the final AbiWord binary will need to run is only what's included in ots-libs and/or ots.
Compilation, however, must insert into that binary all the instructions to find and load the ots stuff. This extra information is in separate packages, marked with the -devel suffix, because it's only needed on computers where the compilation happens. That's why I installed all the packages:
#> yum install ots-devel ots ots-libs
When you've repeated this boring but simple search for every package that was not found, configure will create a "Makefile" (see below) and terminate with a report like this (heavily cut for brevity):
Configuration: host x86_64-unknown-linux-gnu dynamic binary yes ... Optional features: menubutton no printing yes ... Optional dependencies: gio yes gsf-gio yes ... Builtin plugins Plugins s5 hrtext pdf etc etc... make
The Makefile is the exact sequence of commands, customized for your computer, that the "make" utility must run to actually compile the program. Just type "make" (no quotes) at the promp and wait, as this is the longest step. Please note that even this phase may abort because of missing components that are undetected by the configure script. Again, no big deal: just find and install them as explained above, and then retype "make." In my example, "make" stopped with this error:
"/bin/ld: cannot find -lt1"
which I solved typing "yum install t1lib t1lib-devel"
Finally, make install
When "make" ends without errors, all that's left is to move its "products" to their final installation directory. The most common default value is /usr/local, but you can change it passing the prefix=/path/to/some/other/folder parameter to configure. So, type "make install" (no quotes), and when it's finished, enjoy the free software you just installed from source (see the image above).
Thanks to the subscribers of the AbiWord and Fedora user mailing lists who helped me in this post. Also, be sure to tune in next week for a review of my newly installed AbiWord 3.0.0!
Marco Fioretti is a freelance writer and teacher whose work focuses on the impact of open digital technologies on education, ethics, civil rights, and environmental issues.