Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(compat): include stdlib.h so getenv/_putenv_s compile on native ARM64 Windows

Martin Vogeld30bccd772f3
diff --git a/src/foundation/compat.h b/src/foundation/compat.h
index 4ac9bf755..40f1ebf05 100644
--- a/src/foundation/compat.h
+++ b/src/foundation/compat.h
@@ -10,6 +10,12 @@
#include <stddef.h>
#include <stdio.h>
+/* stdlib.h declares getenv (cbm_tmpdir) and, on Windows, _putenv_s (cbm_setenv/
+ * cbm_unsetenv). The x86-64 mingw toolchain pulled it in transitively, but the
+ * aarch64 (CLANGARM64) include chain does not, so include it directly — without
+ * it those calls become implicit declarations that conflict with the real
+ * stdlib.h types and fail to compile on native ARM64 Windows. */
+#include <stdlib.h>
/* ── Thread-local storage ─────────────────────────────────────── */
/* _Thread_local is C11 standard — works on GCC, Clang, and MSVC (2019+).