Free Doesn't Necessarily Mean Easy

There is a great deal of free software available on the internet that will compile on our Unix machine, Bama. While much of it is well developed and will compile quite easily, you will occasionally encounter problems. Understanding how these programs are designed to be compiled will help you avoid trouble.

Read the README

Your first step should always be to read the file called "README" or "INSTALL". There should be step-by-step instructions for configuring and compiling the program. The software needs to be configured because it will have support for many different operating systems built into it. In addition, each operating system may have different capabilities in its setup. Such differences may include which compilers are available, which windowing system is being used, which libraries are available for linking, among other things. You will need to tell the setup program just which system we have. The configuration step sets up all this.

You should be given information about how to compile the program, where it can be installed (i.e. moved for general use), what supporting files are made or required, like man pages, libraries, or setup files for running it. You should note that there are some programs that want to put information into system directories. You cannot do this! Only the system administrator can do this. In this case, look for alternative setup information or contact the help desk about have a system-wide installation done. If the software has broad enough appeal, this can be done.

Configure

Configuration can be done in a variety of ways. Configuration is being done automatically now in many software packages. If the install instructions indicate, you will run a program called "configure". This is usually done this way:

./configure

to make sure you are getting the version of "configure" in your local directory. The program will do an inventory of the system on Bama, checking to see what our compilers have and how the machine treats files and data. It will ask you questions along the way. The default answers, as indicated, will generally be fine, with the exception of the directory names where you want the software and supporting files installed. You'll need to consider where you want the program to go.

An older configuration style will ask you to edit a file called "config.h". These are more difficult to understand. They will use the C-programming syntax to set variables. Anything that is sandwiched between "/*" and "*/" is a comment. The compiler will read everything else. You surround the things you don't need with the comment marks; you uncomment the things you do need.

Another old configuration style asks you to edit the "Makefile" (or "makefile") directly. Again, it is a matter of commenting and uncommenting lines, although in this case, comments begin with the "#" character. Before you edit the "Makefile" you should copy it so you'll have a backup in case of emergency (such as, you make an editing error that you can't undo).

Another configuration style will have all the necessary setup contained in "Makefile" and editing is not necessary. The proper configuration is accessed when the makefile is run.

As you are choosing options, remember that we are using Solaris 2.5 and we have the C compilers, cc and gcc (there are times when gcc is the better choice).

Compile

Compilation is almost universally done with "make". This is a Unix package that uses a setup file called "Makefile" or, possibly, "makefile". "Makefile" contains the rules for how the program is to be compiled and probably was created or edited in the configuration step. Running "make" can take instructions such as "make all", "make install", etc. Most "Makefiles" will work such that just typing "make" will get you started.

If "make" encounters an error, then there are many times where you can make a simple correction and just type "make" again. This program is designed to start up where it left off.

In case of a real disaster, it should be possible to type "make clean", which will remove all previously created files (such as ".o" files from the compile step or even "Makefiles" created by "configure"). You can then start over with a clean slate.

If all the necessary configurations were already contained in "Makefile", then the program probably is compiled by typing

make systype

where systype is the name for our system as indicated in the instructions.

Install

Lastly, there will probably be an installation step. Since users cannot install in system directories, their next best option is to install in a special directory they keep just for that purpose. A common choice for such a directory is one called "bin" which is under your home directory. On our system, then, it might be "/st1/userid/bin" for students (also /st2 and /st3) or "/fs/userid/bin" for faculty where "userid" is your actual userid. This directory should be put into your path. To do this you will modify the ".profile" file in your home directory. You would add these two lines:

PATH=$PATH:~/bin 
export PATH 

The "~" is a special character which refers to your home directory.

 

This covers the general steps involved with adding software. There are times when more severe problems are encountered, such as the source code won't compile correctly, or software is missing. Sometimes this is due to a wrong choice in the configuration; choosing the wrong operating system type, for instance. Other errors can crop up when the software is badly written. Contact the Help Desk if you can't get around the problems.

 

© 1998, The University of Alabama. The information included here is for the University of Alabama central computing facility as it was configured on the document date. It may or may not apply to other Unix systems.