oven-sh/bun · error · Error

CMAKE_BUILD_ROOT is not defined

Error message

CMAKE_BUILD_ROOT is not defined

What it means

Error "CMAKE_BUILD_ROOT is not defined" thrown in oven-sh/bun.

Source

Thrown at src/codegen/bundle-functions.ts:63

import assert from "assert";
import { readdirSync, rmSync } from "fs";
import path from "path";
import { sliceSourceCode } from "./builtin-parser";
import { createAssertClientJS, createLogClientJS } from "./client-js";
import { getJS2NativeDTS } from "./generate-js2native";
import { cap, checkAscii, low, writeIfNotChanged } from "./helpers";
import { applyGlobalReplacements, define } from "./replacements";

const PARALLEL = false;
const KEEP_TMP = true;

if (import.meta.main) {
  throw new Error("This script is not meant to be run directly");
}

const CMAKE_BUILD_ROOT = globalThis.CMAKE_BUILD_ROOT;
if (!CMAKE_BUILD_ROOT) {
  throw new Error("CMAKE_BUILD_ROOT is not defined");
}

const SRC_DIR = path.join(import.meta.dir, "../js/builtins");
const CODEGEN_DIR = path.join(CMAKE_BUILD_ROOT, "./codegen");
const TMP_DIR = path.join(CMAKE_BUILD_ROOT, "./tmp_functions");

interface ParsedBuiltin {
  name: string;
  params: string[];
  directives: Record<string, any>;
  source: string;
  async: boolean;
  enums: string[];
}

interface BundledBuiltin {
  name: string;
  directives: Record<string, any>;

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at src/codegen/bundle-functions.ts:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/661283bb90d6a8e6. Report an issue: GitHub.