SCons Pages:

  1. SCons: An Introduction
  2. Making Builds with SCons
  3. SCons for Developers


On this page:

Also see:

Making Builds with SCons

ARCHIVED COPY - Obsolete - for current version, click here.

This document is intended primarily for those who want to build SAS software such as ScienceTools from source, or for those doing restricted development of C++ or Python code which does not involve adding new libraries, creating new packages, etc. The full-time developer should also consult SCons for Developers. End users (those wishing only to run applications, not build them) should see SCons: An Introduction.

Full documentation on all SCons features can be found at: .

GoGui: A GUI for developing with SCons

GoGui provides a development environment for SCons similar to that provided for CMT by MRvcmt. Functions include CVS checkout, commit, update and tagging; building a package or an entire installation; and running and debugging programs. For a more complete description including screen shots, see

Using GoGui.

Running SCons from the Command Line

See the initial sections of SCons for Developers for prerequisites. In particular, suitable versions of Python (at least 2.5.1; 2.6.x imminent) and SCons (1.3.0 recommended for all platforms; required for Windows) should be installed. It will be more convenient to use SCons from the command line if it is in your path. The environment variable GLAST_EXT should be suitably defined.

Command line help

For options available with SCons as distributed (and assuming the scons command is in your path) type

scons -H

To get help on additional options added specially for SAS software such as ScienceTools, you must first have a local installation of the software.

Source installation from CVS

To check out ScienceTools, first refer to the New Release Manager web interface for ScienceTools to determine the version you are interested in (e.g., LATEST1.2957), then issue the cvs command:

cvs co -r ScienceTools-LATEST-1-2957 ScienceTools-scons

Next enter the ScienceTools-scon directory that was created. The SConstruct file that is read by SCons is in this directory.

Then, assuming scons is in your path, to get a list of all options (those included with the SCons distribution and those added to SCons specifically for SAS software) issue the command:

scons --help

Note: The options like --with-GLAST-EXT, written specifically for SAS software, have been added locally. They were not written — and are not supported — by the SCons developers.


Source installation from RMViewer

After selecting the release and operating system you are interested in, choose "Source Download" from the Download menu. See the RMViewer Users Guide for complete information on installing and using RMViewer.

Building a Single, Specific Package (and its dependencies)

To build a single package, simply specify the package name as the target preceded by options as needed.

Note: The --with-GLAST-EXT option must always be supplied; others are optional under most circumstances.

For example, on most platforms to make a debug build of the astro packages (and any dependencies) issue the following command:

scons --with-GLAST-EXT=${GLAST_EXT} --compile-debug astro

More Build Examples

You may replace package name (astro in the above command) with any of the following:

all builds absolutely everything
includes installs all public include files
xml installs all public xml files
to_install installs all source files which need to be available at run time: xml, includes, data, pfiles, job options, python
doxygen runs doxygen for all packages and installs results
libraries builds and installs all libraries (shared or static of all kinds)
test builds and installs all test programs and their wrapper scripts
binaries builds and installs all other (non-test program) executables and their wrapper scripts
StudioFiles builds and installs all project and solution files (Windows only)
astro-libraries builds and installs all libraries belonging to the astro package. Substitute any other package name for astro. Similarly build and install all programs (test or not) with target astro-programs and all project and solution files with astro-StudioFiles.

Ignoring Errors

By default, SCons will stop compilation after the first error it encounters. If the first error is not in a package of interest, you can tell SCons to continue building after it encounters an error by appending the -i option to the SCons command.


SCons Build Output

When SCons is performing a build, some output (e.g. libraries) is dependent on compiler, operating system, and settings such as debug/optimized. Such output is kept in variant subdirectories. Typical variant names are redhat4-i686-32bit-gcc34-Optimized and XP-i386-32bit-vc71-Debug.

Output needed to run programs (as opposed to intermediate build products) ends up in one of the following subdirectories of the directory containing the SConstruct file:

  • bin/variant
All set-up and wrapper scripts for variant.
  • include/packageName
All the globally shared header files for packageName.
  • exe/variant
Binary executable programs. Wrapper scripts call one of these programs.
  • lib/variant
All the libraries for the variant, both shared and static. This variant string is the same as above.
  • pfiles/packageName
All the pfiles for packageName.
  • python
Python files meant to be public. Module structure is preserved. There is no subdivision by package.
  • xml/packageName
Exported xml files for packageName.

Note: Additional output directories will be created in the future, and they will follow the same convention:

  • If the contents of the directory are dependent on the OS, or on the compile options, SCons will include the variant subdirectory.
  • If the contents are independent of such changes, SCons will not include the variant subdirectory.

Owned by: Joanne Bogart, and Heather Kelly

Last updated by: Joanne Bogart 06/16/2010