You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 19 Next »

Introduction

We are planning to move away from CMT as our build tool in favor of a the more flexible SCons.  What is SCons?  "SCons is an Open Source software construction tool---that is, a next-generation build tool. Think of SCons as an improved, cross-platform substitute for the classic Make utility with integrated functionality similar to autoconf/automake and compiler caches such as ccache. In short, SCons is an easier, more reliable and faster way to build software." - http://scons.org/

Getting Started

The latest version of SCons installed at SLAC is version 1.2.0.

 Please Note:  As of November 21, 2008, ScienceTools is the only checkout package fully prepared to be built using SCons.  GlastRelease is a work in progress.

SLAC Linux

SCons is installed at SLAC in /afs/slac/g/glast/applications/SCons

Desktop Machines

Prerequisites:
Python 2.5.1 available from the installer [see the workbook for details]
CVS access [see the workbook for details]

Obtain SCons from http://scons.org

External Libraries

In our move to SCons, we have decided to also modify our directory structures for the external libraries to provide a directory structure which includes compiler in its path.  For example, CLHEP's include and lib directories are in:  redhat4-x86_64bit/CLHEP/1.9.2.2/gcc34/

The reorganized external libraries are installed at SLAC and are available in the V: drive on windows and on Linux in /afs/slac/g/glast/ground/GLAST_EXT
redhat3-i686-32bit/    redhat5-i686-32bit/    redhat4-i686-32bit/           redhat4-x86_64-64bit/       tiger-i386-32bit/

To set up the externals on a desktop, you may download them via the RMViewer.  For more information concerning the RMViewer see: RMViewer User Guide

Tagging Convention

Under CMT our checkout packages, such as ScienceTools and GlastRelease are tagged as virjpk.  In SCons, these same packages have tags of the form: <packageName>-00-00-00  HEAD versions of a checkout package are referred to as:  <packageName>-HEAD-1-1234 and simililarly LATEST uses the form:  <packageName>-LATEST-1-1234

Obtaining a copy of the code from CVS

Checking out the current release of ST:

cvs co -r ScienceTools-09-10-00 -d ScienceTools-09-10-00 ScienceTools-scons

After the completion of this command you would enter the ScienceTools-09-10-00 directory that was created. In this directory there is the SConstruct file that is read by SCons.

To get a list of options added to SCons specifically for ScienceTools you can issue the command:

scons --help

These options have been programmed into the SConstruct and support files for ScienceTools. They are not written or supported by the SCons developers. To see the options that are written and supported by the SCons developers you need to issue the command

scons -H

Building only a specific package and its dependencies

To build only a single package simply specify the package name as the target. For example, to build facilities (and its dependencies) issue the following command along with any other options necessary

scons --with-GLAST-EXT=$GLAST_EXT facilities >& build-facilities.log &

Building All

In the top-level directory, where the SConstruct file is located, to build all and redirect output to a log file:

scons --with-GLAST-EXT=$GLAST_EXT all >& build-all.log &

Debug Build

Include the flag --compile-debug

Ignoring errors

By default SCons will stop compilation after the first error it encounters. Since the first error is most likely not in a package of interest, one can tell SCons to continue building after it encounters an error. To do this you append the -i option to the SCons command.

SCons build output

When SCons is performing the build process it will put files in the following subdirectories that are located in the same directory as the SConstruct file:

  • include/[packageName] - all the globally shared header files for [packageName]

  • bin/[variant] - all wrapper scripts for the variant. A variant specifies the OS and compile options such as debug or optimized, such as redhat4-x86_64-64bit

  • exe/[variant] - the binaries

  • lib/[variant] - all the libraries for the variant. This variant string is the same as above

  • pfiles/[packageName] - all the pfiles for [packageName]

Other such output directories will be created in the future and they will follow the same convention. If the contents of the directory is dependent on the OS or the compile options, it will include the variant sub directory. If it is independent of such changes it will not include that directory.

Specific Examples

Test Drive Building ScienceTools 09-10-00 with SCons

Test Drive Building GlastRelease 15-49-00 with SCons

References

https://confluence.slac.stanford.edu/display/SAS/SCons

http://www.slac.stanford.edu/exp/glast/ground/software/notes/GoGui/GoGui-use.shtml

  • No labels