The easiest way to build the SLIC simulator package is using the SimDist CVS project.
Depending on your system speed, the entire build process will take around 2 hours, but starting the automated build only takes about 5 minutes.
Basic Build Procedures
If you want to execute each step of the build yourself, these are the commands used by the build script (covered in next section).
./configure [options] make &> build.log & tail -f build.log
The configure command can be modified with options. (see available options with './configure --help')
The last command will tail the log file, so that you can see the progress of your build.
Build Script
There is also a short bash script for running the build.
cvs -d :pserver:anonymous@cvs.freehep.org:/cvs/lcd co SimDist cd SimDist chmod +x build.sh ./build.sh
This will create the log files configure.log and build.log, which might be useful if your build fails.
Testing the Build
Try executing this script when the build completes.
./scripts/slic.sh
If there is an error running the slic binary using this script, then check your build logs (starting at the top) for error messages.
Troubleshooting Common Build Problems
The most common problems are related to configuration of Geant4, because it is a large, complex package. And it has no standard configure script. Make sure that the options generated by SimDist at packages/geant4/env.gmk make sense for your platform. For instance, if you don't have the OpenGL headers and libraries, then all the GL variables should not have a value. A blank variable means that the corresponding option will not be enabled. These variables are basically passed directly to Geant4's build system. Refer to the Geant4 documentation of these settings for more details.
Commands to the slic package only can be used to debug problems that occur with other dependencies. For instance, if the slic build complains about missing LCIO headers, then the LCIO library build probably failed. Or if there are a bunch of error messages about linking against Geant4, then part of Geant4 likely did not compile correctly.
If all of the above fails to get a working SimDist, then send email to jeremym AT slac DOT stanford DOT edu with the following.
- OS variety and kernel version e.g. for Linux
cat /etc/redhat-release; uname -a
- gcc version
gcc -v
- 32 or 64 bit
uname -m
- log of global configure command
cd SimDist; ./configure &> myconfig.log
Please attach or inline the snippets containing build errors from your logs. I don't want full log files, if possible. Usually, the first error in the log is the most relevant.
Advanced Instructions
The SimDist build system is based on GNU Autoconf and Make. Individual packages can be manipulated using make commands from their appropriate package directories.
For instance, to cleanly recompile slic, execute these commands.
cd SimDist/packages/slic make packageclean make
Most packages support the following make targets through a generic packaging system.
make # execute standard build targets in order make cvs # checkout from cvs make packageclean # removes the current build make download # download a tarball of the package make config # execute configure script or commands make compile # compile the libraries or binary make install # install the package
Most packages support either a cvs or a download command, depending on whether they are accessible in the SLAC cvs repository. Those packages that are not in a SLAC cvs are most likely only accessible via wget download.
Package System
SimDist operates on a loose system of package configuration which sets a number of standard build variables in the configuration stage for each package in the packages directory. A configure script in the base directory generates the actual Make file fragments for the packages, depending on the configuration selected and on the properties of the local host. Following the Autoconf build system, there are .in files in the package directories that are used by the configure script to generate these Make fragments.
Each package also has a file called package.gmk where it may override or add build settings.
For instance, sometimes it is useful to enable verbose compilation and linking when building slic (the final package to be built by an in-order build).
To do this, add an option to its package.gmk file in packages/slic/package.gmk.
PACKAGE_CONFIG_OPTS="--enable-compile-verbose"
Other options available in the slic build only can be viewed in the slic directory.
cd slic/HEAD ./configure --help
For instance, there are options for making gdb-enabled binaries. These could be passed to SimDist by adding this option to slic's package.gmk file.
PACKAGE_CONFIG_OPTS="--enable-gdb=yes"
Each package has different possible options for this variable. The above examples will not work on other packages with SimDist, only the slic package.
Package Explanation and Standard Variables
The core of the SimDist build system is in build/package.gmk where a standard set of build procedures is defined for each package. This includes automation of the normal procedure of getting sources, configuring them, executing the build command (usually 'make'), and installing the binaries or headers.
Each package may have some or all of the following defined. The Make fragment is pretty flexible about working around missing information.
Variable |
Meaning |
---|---|
PACKAGE_NAME |
short name of package |
PACKAGE_BASEDIR |
base directory |
PACKAGE_BUILDDIR |
build directory |
PACKAGE_CONFIG |
configure command if not standard |
PACKAGE_CONFIG_OPTS |
extra options to configure command |
PACKAGE_CVSMODULE |
name of the package's cvs module |
PACKAGE_CVSROOT |
the CVSROOT for the package's cvs repository |
PACKAGE_DIR |
package directory containing package.gmk and env.gmk |
PACKAGE_DIR_ORIG |
original directory name e.g. if downloaded from tarball |
PACKAGE_DOWNLOAD |
URL of package tarball |
PACKAGE_TGZ_LOCAL |
name of the tarball locally |
PACKAGE_VERSION |
version tag of the package or HEAD for its cvs head |
PACKAGE_DIST_TGZ |
name of tarball if distributing this package |
PACKAGE_DIST_FILES |
list of files to be included in distribution of this package |
These variables can be overridden or added by editing the file package.gmk within each package's SimDist directory (see above example for slic).
Additionally, each package includes variables necessary for its build in the file env.gmk. This should generally not be edited by hand, whereas editing package.gmk can sometimes be useful.
Both the package.gmk and env.gmk files are rewritten when a global configure command is executed from the SimDist base directory. This is by design, following the convention of Autoconf. If you really want changes to stay, the .in files can be edited. But only a few of the variables are likely going to be useful, such as PACKAGE_CONFIG_OPTS, for passing options to the package's configure script.