{"record":{"id":"f7700fa09f1a21f8","repo":"clockworklabs/SpacetimeDB","slug":"cmake-not-found-in-path","errorCode":null,"errorMessage":"`cmake` not found in PATH.","messagePattern":"`cmake` not found in PATH\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/cli/src/tasks/cpp.rs","lineNumber":51,"sourceCode":"\npub(crate) fn build_cpp(project_path: &Path, build_debug: bool) -> anyhow::Result<PathBuf> {\n    // Verify required tools are in PATH\n    #[cfg(windows)]\n    let emcc_found = find_executable(\"emcc.bat\").is_some();\n    #[cfg(not(windows))]\n    let emcc_found = find_executable(\"emcc\").is_some();\n\n    if !emcc_found {\n        return Err(anyhow!(\"`emcc` not found in PATH. Activate Emscripten (emsdk_env).\"));\n    }\n\n    #[cfg(windows)]\n    let cmake_found = find_executable(\"cmake.exe\").is_some();\n    #[cfg(not(windows))]\n    let cmake_found = find_executable(\"cmake\").is_some();\n\n    if !cmake_found {\n        return Err(anyhow!(\"`cmake` not found in PATH.\"));\n    }\n\n    #[cfg(windows)]\n    let emcmake_found = find_executable(\"emcmake.bat\").is_some();\n    #[cfg(not(windows))]\n    let emcmake_found = find_executable(\"emcmake\").is_some();\n\n    if !emcmake_found {\n        return Err(anyhow!(\"`emcmake` not found in PATH. Is Emscripten env active?\"));\n    }\n\n    let build_type = if build_debug { \"Debug\" } else { \"Release\" };\n    let build_dir = project_path.join(\"build\");\n\n    // === Configure (no generator flags; let emcmake/cmake decide or reuse existing) ===\n    // This matches: emcmake cmake -B build .\n    // We keep -S/-B so `project_path` can be anywhere, and pass CMAKE_BUILD_TYPE (ignored by multi-config).\n    let cfg_args = [","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/cli/src/tasks/cpp.rs#L33-L69","documentation":"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.","triggerScenarios":"`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).","commonSituations":"Slim Docker/CI images; system cmake installed as cmake3 or via snap but not linked as cmake; PATH not including the CMake bin directory.","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"],"exampleFix":"# before\nspacetime build            # cmake not found in PATH\n\n# after\nsudo apt install cmake && spacetime build","handlingStrategy":"validation","validationCode":"# bash: verify cmake before building C/C++ modules\ncommand -v cmake >/dev/null || { echo \"install cmake first\" >&2; exit 1; }\nspacetime build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include cmake in Dockerfiles/CI images used for SpacetimeDB C/C++ modules","Check `cmake --version` when setting up a new machine before first build"],"tags":["build","cpp","cmake","environment"],"backgroundTag":"missing-build-tool","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}