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

Compare with Current View Page History

« Previous Version 11 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 current version of SCons installed at SLAC is version 1.0.1, the current release version of SCons is 1.1.  Those starting out with SCons are free to use the current release 1.1.

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

Taking SCons for a Test Drive

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.

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, for CLHEP the 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/

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>-virjpk  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-v9r8p2 ScienceTools-scons

After the completion of this command you would enter the ScienceTools-scon 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 facilities

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 the binaries for the variant. A variant specifies the OS and compile options such as debug or optimized.

  • 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.

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