{"id":4758,"library":"scons","title":"SCons","description":"SCons is an Open Source, next-generation software construction tool written in Python, similar to GNU Make but using Python scripts for configuration. It provides automatic dependency analysis, support for parallel builds, and is designed for cross-platform software development. It is actively maintained with frequent releases, currently at version 4.10.1, offering new functionality, enhancements, and bug fixes.","status":"active","version":"4.10.1","language":"en","source_language":"en","source_url":"https://github.com/SCons/scons","tags":["build-system","dev-tools","compilation","python-scripting","dependency-management","cross-platform"],"install":[{"cmd":"pip install scons","lang":"bash","label":"Install SCons via pip"}],"dependencies":[{"reason":"Required for the experimental Ninja feature.","package":"ninja","optional":true}],"imports":[{"note":"SCons build functions like `Environment`, `Program`, `Library`, etc., are implicitly made available in the global namespace of `SConstruct` and `SConscript` files. Explicit `import` statements for these core functions are generally not needed or used in typical build scripts. Standard Python modules like `os` can be imported as usual.","symbol":"Environment","correct":"env = Environment()"}],"quickstart":{"code":"# SConstruct file\nenv = Environment()\nenv.Program('hello.c')\n\n# hello.c file\n#include <stdio.h>\n\nint main() {\n    printf(\"Hello, SCons!\\n\");\n    return 0;\n}\n\n# To build, run in terminal:\n# scons\n# To clean, run in terminal:\n# scons -c","lang":"python","description":"Create an `SConstruct` file and a source file (e.g., `hello.c`) in the same directory. The `Environment()` function creates a build environment, and `env.Program()` defines a program target. Run `scons` from your terminal in the project's root directory to build the target."},"warnings":[{"fix":"Ensure your Python environment is version 3.7 or newer. Upgrade Python if necessary.","message":"SCons 4.9.0 dropped support for Python 3.6. Python 3.7 or higher is now required.","severity":"breaking","affected_versions":"4.9.0 and later"},{"fix":"Update calls to `env.Dump()` to pass multiple keys as separate arguments or adapt to the new behavior if only a single key was expected.","message":"The `env.Dump()` method's API changed in SCons 4.8.1. It now accepts multiple optional 'key' arguments instead of a single one. Scripts relying on the old single-key behavior may need adjustment.","severity":"breaking","affected_versions":"4.8.1 and later"},{"fix":"Explicitly pass required environment variables to the `Environment()` constructor, e.g., `env = Environment(ENV=os.environ)` to inherit all, or `env = Environment(ENV={'PATH': os.environ['PATH']})` for specific ones.","message":"SCons construction environments (created with `Environment()`) do not automatically inherit the full external `PATH` or other environment variables from the shell that invoked `scons`. This can lead to issues where compilers or tools are not found.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Run `scons` from the directory containing `SConstruct`, or use options like `-u` (search up directory tree) or `-f FILE` (specify SConstruct file path) if invoking from a subdirectory.","message":"SCons typically expects an `SConstruct` file in the current working directory. If not found, it will report 'No SConstruct file found'.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Upgrade to SCons 4.10.1 or newer to avoid `profile` module deprecation warnings.","message":"SCons 4.10.1 switched its internal test framework from `profile` to `cProfile` to avoid deprecation warnings introduced in Python 3.15. Older SCons versions might emit warnings if used with Python 3.15+.","severity":"gotcha","affected_versions":"Older than 4.10.1 when used with Python 3.15+"},{"fix":"Review existing build scripts that process SCons Node objects, especially if they perform strict type checking or rely on string-specific path manipulations. Convert Nodes to strings explicitly if needed (e.g., `str(node)`).","message":"As of SCons 4.10.0, Nodes are treated as `PathLike` objects. This change may affect scripts that explicitly expected string paths when interacting with SCons Nodes.","severity":"gotcha","affected_versions":"4.10.0 and later"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}