scons: Python-Based Software Construction
scons builds targets described in an SConstruct file written in Python, resolving dependencies with content signatures rather than timestamps.
SCons uses Python for build description and MD5 content signatures to decide what is stale, which makes rebuilds reliable. In CI it behaves much like make with -j for parallelism.
What it does
scons reads SConstruct (and any SConscript files), builds the dependency graph, and constructs targets. Because it uses content signatures by default, an unchanged file does not trigger a rebuild even if its timestamp changed.
Common usage
scons -j$(nproc)
scons -C path/to/project
scons build/myprogram
scons mode=release VERBOSE=1Options
| Flag | What it does |
|---|---|
| -j <N> | Number of parallel jobs |
| -C <dir> | Change to <dir> before reading SConstruct |
| -c | Clean the specified targets |
| -n | Dry run: show actions without executing |
| <name>=<value> | Pass build variables into the SConstruct |
| -Q | Quiet the progress messages |
In CI
SCons is a Python package; install it with pip (pip install scons) or the distro package before building. Its content-signature model plays well with caches: the .sconsign database and CacheDir() let CI reuse unchanged objects. Pass -j explicitly since SCons does not parallelize by default.
Common errors in CI
"scons: *** No SConstruct file found." means you are not in the project root or the file is named differently (use -f). "scons: command not found" means the package is not installed. "AttributeError" or "NameError" tracebacks come from the SConstruct Python itself, often a variable a CI invocation did not set. "Do not know how to build ... target" means a typo in the requested target path.