clockworklabs/SpacetimeDB · error · anyhow::Error
`cmake` not found in PATH.
Error message
`cmake` not found in PATH.
What it means
Second preflight in build_cpp: the cmake executable (cmake / cmake.exe) is not resolvable on PATH. C/C++ module builds are driven through CMake project files, so the build refuses to start without it, even if Emscripten itself is active.
Solutions
- Install CMake: `apt install cmake` / `brew install cmake` / winget or the official installer on Windows
- Ensure the cmake binary's directory is on PATH (`which cmake` must succeed)
- Re-run `spacetime build` after `cmake --version` works
Example fix
# before spacetime build # cmake not found in PATH # after sudo apt install cmake && spacetime build
Defensive patterns
Strategy: validation
Validate before calling
# bash: verify cmake before building C/C++ modules
command -v cmake >/dev/null || { echo "install cmake first" >&2; exit 1; }
spacetime build Prevention
- Include cmake in Dockerfiles/CI images used for SpacetimeDB C/C++ modules
- Check `cmake --version` when setting up a new machine before first build
When it happens
Trigger: `spacetime build` on a C/C++ module on a machine where CMake is not installed or not on PATH (e.g. minimal containers, fresh macOS without homebrew, Windows without CMake in PATH).
Common situations: Slim Docker/CI images; system cmake installed as cmake3 or via snap but not linked as cmake; PATH not including the CMake bin directory.
Related errors
- `emcmake` not found in PATH. Is Emscripten env active?
- `emcc` not found in PATH. Activate Emscripten (emsdk_env).
- Cannot extract accessor name from query
- Cannot read environment schema: HTTP
- [CIRCULAR REFERENCE ERROR] Module cleared and replaced with…
AI-assisted analysis of clockworklabs/SpacetimeDB@6dee26c6ef (2026-08-20).
Data as JSON: /api/errors/f7700fa09f1a21f8.
Report an issue: GitHub.
Appendix: source
Thrown at crates/cli/src/tasks/cpp.rs:51
pub(crate) fn build_cpp(project_path: &Path, build_debug: bool) -> anyhow::Result<PathBuf> {
// Verify required tools are in PATH
#[cfg(windows)]
let emcc_found = find_executable("emcc.bat").is_some();
#[cfg(not(windows))]
let emcc_found = find_executable("emcc").is_some();
if !emcc_found {
return Err(anyhow!("`emcc` not found in PATH. Activate Emscripten (emsdk_env)."));
}
#[cfg(windows)]
let cmake_found = find_executable("cmake.exe").is_some();
#[cfg(not(windows))]
let cmake_found = find_executable("cmake").is_some();
if !cmake_found {
return Err(anyhow!("`cmake` not found in PATH."));
}
#[cfg(windows)]
let emcmake_found = find_executable("emcmake.bat").is_some();
#[cfg(not(windows))]
let emcmake_found = find_executable("emcmake").is_some();
if !emcmake_found {
return Err(anyhow!("`emcmake` not found in PATH. Is Emscripten env active?"));
}
let build_type = if build_debug { "Debug" } else { "Release" };
let build_dir = project_path.join("build");
// === Configure (no generator flags; let emcmake/cmake decide or reuse existing) ===
// This matches: emcmake cmake -B build .
// We keep -S/-B so `project_path` can be anywhere, and pass CMAKE_BUILD_TYPE (ignored by multi-config).
let cfg_args = [View on GitHub (pinned to 6dee26c6ef)