Skip to content

Zero dependencies on every platform: the SDK carries link stubs, CRT, builtins, libc++ and headers (no Xcode/CLT, no MSVC/Windows SDK, no system glibc/libgcc) #1915

Open

Description

@ehartford

Ruling (Eric, 2026-09-29): "I want zero dependencies in all platforms … except our own SDK and system calls." Build time reads only our SDK (.deps, pinned by sdk.lock, #1913); run time depends only on what the OS ships at the system-call boundary: macOS libSystem, the Linux kernel, Windows in-box DLLs (kernel32/ntdll/ucrtbase — not vcruntime140, a redistributable).

What is borrowed today

host borrowed where
macOS Xcode/CLT SDK: libSystem.tbd, libc++.tbd, libm, headers (SDKROOT, #1826) build/compiler.w comp_host_sdk_path, -syslibroot/-isysroot; Link.w -lSystem; ClangBridge -isysroot
Linux system glibc crt1.o/crti.o/crtn.o, libc.so, dynamic linker path, gcc's crtbegin/crtend + libgcc Link.w link_stage_linux_*
Windows Visual Studio CRT (msvcrt/vcruntime/libcmt/libcpmt, legacy_stdio_definitions, oldnames), Windows Kits import libs and headers (WITH_WINDOWS_*, winenv.sh) Link.w link_stage_make_windows_llvm_link_command, ClangBridge incdirs (#1914)
all the compiler's own link uses the host C++ runtime for the LLVM archives build/compiler.w link rsp

The SDK carries instead (Zig's proven model, .reference/zig/lib/libc)

  1. macOS: libSystem.tbd (+ libc++.tbd; both dylibs are in the OS) and the macOS libc headers per target; -syslibroot/-isysroot point into the SDK. SDKROOT becomes an override only. Closes the Build: the lld stage link fails on Xcode 27's SDK (.tbd target arm64e.x1-macos) when SDKROOT points at it; comp_host_sdk_path trusts SDKROOT unchecked #1826 class for good.
  2. Linux: glibc abilists → generated stub libc.so.6/libm/libpthread/libdl/ld-linux for a pinned minimum glibc; crt1/crti/crtn built from glibc csu sources; compiler-rt builtins replace libgcc; crtbegin/crtend from compiler-rt; headers per target.
  3. Windows: mingw-w64 .def files → import libs for the in-box DLLs (kernel32, advapi32, bcrypt, ucrtbase / api-ms-win-crt-), mingw CRT startup built from source, compiler-rt builtins; programs link UCRT only (no vcruntime); mingw-w64 headers for c_import. WITH_WINDOWS_ / winenv.sh / vswhere go away (A failed link or helper compile prints only 'build failed' (seed_compile_binary drops diagnostics); Windows toolchain lookup superseded by #1915 #1914).
  4. The compiler's own link: LLVM libc++/libc++abi (+ libunwind on Linux) built static into each SDK; the LLVM/Clang archives are built against it.

Each slice lands with a proof: the release UAT and the battery on a host with no Xcode/CLT (a clean macOS user), no build-essential/gcc (a minimal Linux container), no Visual Studio (a clean Windows VM).

Order: macOS first (release host, #1826), then Windows (#1914), then Linux. Open questions go to Eric per slice (e.g. the minimum glibc version to target; with-get ConanCenter MSVC packages that reference vcruntime symbols).

Activity

  1. ehartford commented on Sep 29, 2026

    @ehartford
    ContributorAuthor

    History (git log -S): the Windows dependency arrived on day one of the Windows bootstrap — 30e1047 (2026-06-04) and b13b9b0 (2026-06-07) hard-coded Windows Kits 10.0.19041 and VS2019 BuildTools 14.29 paths into Link.w and the compiler link, with no ruling; #708 (07-24) and #867 (08-19) built on it (WITH_WINDOWS_*, xwin-splatted MSVC libs for cross). macOS's Apple-SDK link came with c416b0c (05-26), Linux's system crt/gcc objects with e6bb79f (05-27). None was asked for (Eric, 2026-09-29: "somehow, Visual Studio and Windows SDK have been SNUCK in by agents in the interim without asking me").

    Added to this campaign so it cannot recur: a :no-host-toolchain gate (in :gate and the battery) that fails when any compile or link the build runs names a path outside our SDK (.deps), the repo, or out/ — no C:/Program Files*, /Library/Developer, /Applications/Xcode.app, /usr/lib/gcc, /usr/lib/x86_64-linux-gnu. A new external dependency then turns the battery red instead of arriving silently.

  2. 86 remaining items

  3. ehartford commented on Oct 25, 2026

    @ehartford
    ContributorAuthor

    Triage 2026-10-25: the separate finding noted above is filed as #2637.

  4. added this to the post-v0.16.0 milestone on Oct 28, 2026
  5. ehartford commented on Nov 25, 2026

    @ehartford
    ContributorAuthor

    Evidence at main 745403b (2026-11-25): :no-host-toolchain is green on every platform, including the one that was missing.

    platform where result
    windows-x86_64 win10 VM, pinned seed survey: all targets green. 12 link records read; hi.with, cimport_stdio.with and windows_dll_project "built and ran with no Visual Studio or Windows SDK". (The blocker from the last triage, #2637, is closed.)
    darwin-aarch64 this Mac green: SDK cmake and ninja run from the compiler's cache; cc_hello.c through with cc, hi.with, cimport_stdio.with and framework_project built and ran with no host toolchain. Separately: with SDKROOT unset, with run of a program that imports stdio.h and with cc of a C file both work.
    linux-x86_64 eric-5090, fresh clone (during #3604) green, with the two new glibc-floor checks.

    Also since the last triage: on Linux, C built through with cc now stays at the glibc floor (#3604); before that a source-built library could need a newer glibc than the machine had.

    What the done-when still asks for and I have not shown

    1. The proof is worded as "the release UAT and the battery on a host with no Xcode/CLT, no build-essential, no Visual Studio". The lane hides or empties the host toolchain (a sandbox on macOS and Linux, a stripped environment on Windows); it is not a machine that never had one.
    2. On Windows the lane covers three With programs. It does not run with cc on a C file or the SDK's cmake and ninja, which the macOS and Linux lanes do.
    3. Whether the compiler's own build on macOS runs with no Command Line Tools installed: I always build with SDKROOT pointed at them and did not test without.

    Those three are the remaining work here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions