- Hosted by:
Compiling RHexLib components
This page explains how to compile various RHexLib components
and some common problems that you might encounter along the way.
Installation and compilation of SimSect++ is explained in a separate document.
This document assumes that you have read the installation
instructions, and you have the following directory structure
setup in your home directory:
The first thing that needs to be done is to setup the environment
variables required for the compilation of the code. If you are
running csh or tcsh, place the following lines
in the .cshrc file in your home directory:
- setenv RHEX_DIR $HOME/RHex/RHexLib
- setenv SIMSECT_DIR $HOME/RHex/SimSect++
- setenv RHEX_HARDWARE _MICHIGAN_
You might need to logout and log back in for these to take
effect. Alternatively, you can manually execute these command
to set the variables. Note that the RHEX_HARDWARE variable indicates
which hardware component should be used for certain platform
dependent parts of the code. Currently the valid settings are
_MICHIGAN_ and _MCGILL_.
Bash users should put the following lines in the .bashrc
in their home directory.
- export RHEX_DIR=$HOME/RHex/RHexLib
- export SIMSECT_DIR=$HOME/RHex/SimSect++
- export RHEX_HARDWARE=_MICHIGAN_
Once again, logout and log back in to activate these changes.
We are now in a position to compile the library components.
Each of these directories are setup with Makefiles which support
the following commands:
- make clean : Deletes all the compiled object files
and libraries as well as the temporary files and compiled documentation.
- make cleanobj : Only deletes compiled object files.
Leaves the library files intact. This is useful if you want to
use the libraries but want to save disk space by getting rid
of the compiled object files.
- make depend : Determine dependencies between source
files and header files. This is a *very important* command. It
makes sure that when the libraries are being compiled, the dependency
of the sources to the included header files is considered. As
a consequence, when you make a change to a header file, all the
C++ files that use that header file are recompiled. Every time
the #include statements in the files are changed, or when you
freshly uncompress a package, you should issue this command.
Otherwise, strange compile time errors might pop up.
- make or make libs: These commands compile all
the necessary source files in the package and creates thecorresponding
- make all : This command is similar to make, but it
also compiles and builds executable files in the package in addition
to the library files.
- make wc : This is a facility which counts the number
of lines in each of the source files, headers etc. Good for getting
a line count for the source distribution.
- make tarball : Deletes all object files, libraries
(similar to make clean) and creates a .tar.gz archive of the
source tree. This useful for backup and file release purposes.
So, the following command sequence will compile the libraries.
You can use the same command sequence for all the components.
Note that in Linux, you MUST compile SimSect++ before you can
- # cd SimSect++
- # make depend
- # make clean
- # make all
- # cd ../RHexLib; make depend; make clean; make all
- # cd ../MichLib; make depend; make clean; make all
- # cd ../McGillLib; make depend; make clean; make all
In future compilations, just using make all would be
sufficient. This will compile only the sources which have changed
since the last compilation.
Refer to the FAQ below if any errors occurred during the compilation
or any of the steps above.
Frequently Asked Questions, Common Problems
- Q1: I get an error message "make: *** No rule to make
target `clean'. Stop." when I type make clean.
- A1: This means that one of the environment variables RHEX_DIR
or RHEX_HARDWARE was not properly defined. Check the definition
- # echo $RHEX_DIR
- # echo $RHEX_HARDWARE
- The result should be the absolute location of the directory
in which the RHexLib distribution is installed, and the name
of the hardware. i.e.something like:
- Otherwise, repeat the steps above for setting the environment
variables. Also, make sure that the HOME environment variable
is defined. (type echo $HOME). If not, you might need to manually
enter the location of your home directory. i.e. something like:
- setenv RHEX_DIR /home/u/ulucs/RHex/RHexLib
- Q2: I get an error message "Error: RHEX_DIR environment
variable undefined!" when I type make all.
- A2: Once again, the environment variable RHEX_DIR is not
properly defined. Refer to Question 1.
- Q3: I get an error message "Error: RHEX_HARDWARE environment
variable undefined!" when I type make all.
- A3: Once again, the environment variable RHEX_HARDWARE is
not properly defined. Refer to Question 1.