{"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":"validation","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/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/src/tasks/cpp.rs#L33-L69","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"# before\nspacetime build .            # `cmake` not found in PATH.\n# after\nsudo apt install cmake && spacetime build .","handlingStrategy":"validation","validationCode":"command -v cmake >/dev/null || { echo 'cmake missing'; exit 2; }\nspacetime build .","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["spacetimedb","cpp","cmake","missing-toolchain","environment"],"backgroundTag":"missing-build-tool","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}