clockworklabs/SpacetimeDB · error · anyhow::Error
`cmake` not found in PATH.
Error message
`cmake` not found in PATH.
What it means
After the `emcc` check, `build_cpp` likewise verifies that `cmake` (`cmake.exe` on Windows) is reachable on PATH, because the Emscripten project is configured and built through CMake. A missing system cmake aborts here, even when the Emscripten env itself is active.
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 524b4487d9)
Solutions
- Install CMake (`apt install cmake`, `brew install cmake`, choco/winget on Windows, or via IDE/toolchain installer)
- Confirm `cmake --version` runs in the same shell used for `spacetime build`
- On CI, add cmake to the image or use an action that installs it
- If you installed cmake but still fail, reopen the terminal so PATH refreshes
Example fix
# before spacetime build . # `cmake` not found in PATH. # after sudo apt install cmake && spacetime build .
Defensive patterns
Strategy: validation
Validate before calling
command -v cmake >/dev/null || { echo 'cmake missing'; exit 2; }
spacetime build . Prevention
- Install cmake alongside the C/C++ toolchain in dev and CI images
- Preflight `cmake --version` in build scripts
- Reopen terminals after installing tools so PATH refreshes
When it happens
Trigger: Building a C/C++ module on a machine with emsdk activated but no system-wide CMake installed (or CMake not on PATH in the current shell).
Common situations: Minimal containers/CI images that skipped the cmake package; macOS/Linux without build-essential-style prereqs; PATH reordered so a broken cmake shim shadows the real one.
Related errors
- `emcc` not found in PATH. Activate Emscripten (emsdk_env).
- `emcmake` not found in PATH. Is Emscripten env active?
- Built successfully but couldn't find a .wasm under {}
- ERROR: Skipping multi-column index registration '%s.%s' beca
- ERROR: Skipping default-value registration '%s.%s' because c
AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16).
Data as JSON: /api/errors/f7700fa09f1a21f8.
Report an issue: GitHub.