Before you begin, make sure you’ve installed all required dependencies.
Getting the Source
For Googlers Only
Googlers: Add this to your
~/.gitconfig file before running fetch dart:Fetch the Source
Fetch the Dart source tree
- Linux/macOS
- Windows
Syncing Dependencies
The Dart SDK usesgclient to manage dependencies described in the DEPS file.
When you switch branches or update your SDK checkout, run
gclient sync to bring dependencies in sync with the SDK version:Building the SDK
Run the build script
Build the SDK in release mode:The build process may take 10-30 minutes depending on your system.
Build Options
Build Modes
The--mode (or -m) flag controls the optimization level:
- debug: Includes debug symbols, no optimization (faster builds, slower runtime)
- release: Optimized build (slower builds, faster runtime)
- all: Builds both debug and release
Target Architecture
The--arch (or -a) flag specifies the target architecture:
x64, arm, arm64, riscv64
Build Targets
Full SDK (Recommended)
Runtime Only
Most Targets
Testing Your Build
Test Options
The test script supports various options:--runtime: Where to run tests (vm,d8,chrome,firefox, etc.)--compiler: Compiler to use (dartk,dart2js,dart2analyzer)--progress: Progress display style--arch: Target architecture--mode: Build mode to test--time: Show timing information--tasks: Number of parallel test tasks
Build Performance Tips
Use a Local File System
For faster builds, use a local file system for the output directory, especially if your source code is on NFS:Build Notifications
Get notified when long builds complete (macOS and Linux only):Parallel Builds
The build system automatically uses available CPU cores. For testing, control parallelism with--tasks:
Troubleshooting
Build Fails Immediately
Python version issues
Python version issues
Ensure Python 3 is installed and in your PATH:On Windows, make sure
depot_tools/python.bat is first in your PATH.Missing depot_tools
Missing depot_tools
Verify depot_tools is in your PATH:If not found, add depot_tools to your PATH.
Dependencies out of sync
Dependencies out of sync
Run
gclient sync to update all dependencies:Visual Studio Issues (Windows)
Wrong toolchain selected
Wrong toolchain selected
For non-Googlers, set the environment variable:
Visual Studio version not detected
Visual Studio version not detected
Manually specify the Visual Studio version:
Custom executable name (Community Edition)
Custom executable name (Community Edition)
Specify the executable name:
Browser Test Issues
Missing fonts (Linux)
Missing fonts (Linux)
Install required fonts for DumpRenderTree:See LayoutTestsLinux for font installation instructions.
No display available
No display available
Use Or use SSH X tunneling, NX, or VNC.
xvfb to provide a virtual display:Next Steps
ARM/RISC-V Builds
Build for ARM and RISC-V architectures
Android Builds
Build the Dart VM for Android devices
Fuchsia Builds
Build the Dart VM for Fuchsia OS
Contributing
Learn how to contribute to the Dart SDK