Skip to content

with get: c_import, Conan, ToolFs, linking and ownership fixes; darwin release UAT green - #1191

Merged
ehartford merged 24 commits into
mainfrom
with-get-release-uat-rebased
Sep 19, 2026
Merged

ehartford merged 24 commits into
mainfrom
with-get-release-uat-rebased

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

The with get release campaign so far: 22 fix/diagnostic commits plus the investigation record and handoff, rebased onto main (c1760ffd). With this branch the whole darwin :release-uat group is green with floating packages — zlib, bzip2, sqlite3, openssl, libcurl, raylib-spiral — for the first time. It does not make every platform green; the remaining cells are separate root causes listed at the end. Eric's ruling stands: no tag until :release-uat is green on every leg; this PR lands the fixes, not the release.

Closes #1162, #1163, #1164, #1167, #1169, #1171.

What it fixes

c_import on real headers

  • Function macros are registered only after emission succeeds; a macro whose translation failed no longer leaves a dangling reference (82f4b275).
  • Clang recovery declarations are rejected in object-macro probes (034cb91b); constant macro calls are translated before runtime invocations are rejected (5e863b60).
  • Macro collection scaled quadratically with header size (prefix copies of the value table) and stalled Windows package UATs — C import builds macro value tables with quadratic prefix copies, stalling Windows package checks #1163 (0427834b, e783634f).

with get / Conan

Build layer / ToolFs

Linking

Ownership

  • Implicit Result wrapping dropped an owned tail payload before returning it — Implicit Result wrapping drops an owned tail payload before returning it #1169 (d90d1048, consume_moved_operand on the wrapped tail; behav_implicit_result_tail_ownership.w). This is an ownership change inside a multi-change branch; the whole tree passed :move-audit and :drop-audit (below). Say if you want it split out.

Test verdicts and diagnostics

  • Skipped and malformed tests no longer invert a known-issue verdict (739a3ee1).
  • Windows package UAT failures are diagnosed per stage (check/build/run), with native stack capture and isolated diagnosis from failed compiler artifacts (ea35c861, 875d1392, bd0551b0, 31d5cfeb, ca7fb26b, 4845716e, 53fe837b).

docs/with-get-release-investigation.md is the evidence record; docs/handoff.md has the current state and next steps.

Evidence

Pinned seed v0.15.2.0, this commit (28e9eb47; tree identical to the one that first passed): build, :fixpoint, :test-with-audits (1056 behaviour files; drop-audit and move-audit inside it), :test-green, :last-green — all rc=0. Then :release-uat rc=0, 63 s, "all targets green".

The OpenSSL cell specifically died with invalid free on every earlier validation run; its cause was the compiler's own .keys() on a HashMap[str, str] (fixed on main by #1190, D44). With both, with run prints openssl UAT passed.

Release validation on the pre-rebase tip of this branch: run 35420376179 (in progress when this was opened). The PR's CI lanes prove the battery per platform; they do not run with get, so that run is the cross-platform UAT evidence.

Not fixed here — the remaining red cells (from validation run 35388740596)

leg failing
linux-x86_64 libcurl, raylib-spiral (openssl expected fixed by #1190)
linux-aarch64 all six C packages — the arm64 source-build gap
windows-x86_64 bzip2 and libcurl exit 124 at ~185 s; openssl asks lld-link for crypto.lib/ssl.lib although #1171's fix is in the tree and windows-aarch64 links
windows-aarch64 bzip2 and libcurl exit 124 at ~186–190 s
darwin (CI runner only) raylib-spiral: the macOS runner has no OpenGL 3.3 context; it passes locally

Eric Hartford added 24 commits September 18, 2026 21:10
LLDB on the OpenSSL 4.0.2 import observed ci_translate_macros mark OSSL_DEPRECATED emitted at CImport.w:3054, then record the same name untranslated. The stale registry entry authorized a dangling dependent global. Cover successful emission branches, omitted dependencies and equivalent expression forms. Compiler check and dev build pass; targeted positive and diagnostic tests pass.
LLDB stopped ci_try_eval_var_init_for_type on a probe with a Clang error (severity 3); its returned initializer was void { 0, null }. Share parse-error validation with the main header parser and exclude invalid declarations from batched macro type results. Dev build and valid-sibling/used-omission regressions pass.
LLDB observed run_test_file_with_build_settings +348 branch on a skipped test status zero into the unexpected-pass diagnostic. The Darwin gate also compared runtime Macos with Darwin and returned false. Correct both contracts and add a cross-platform CLI verdict matrix. Compiler check and dev build pass; both reduced skip probes now return zero without executing their bodies. Full CLI matrix awaits rebuilt stage2.
LLDB offsetof-guard-lldb.log: ci_object_macro_is_function_call returns w0=1 for offsetof(with_offset_point_t, x), skipping the constant translator. The CI battery reproduced the existing offsetof fixture failure on all five platforms.

Verify: source check and seed-driven dev build pass; eight targeted macro and offsetof fixtures pass. Full stage-chain and package verification remain pending.
ProcDump 12.01 rejects -k with -x before launching: Kill after dump is only valid with AeDebug Just-in-Time support (-i). Remove it from each capture; -n 3 bounds collection and the hosted job cleans up its children.
LLDB on the pinned driver returned /Users/eric/with/$HOME/.local/... from build_cache_collect_output_paths; install execution resolves HOME instead. Reuse its destination resolver so a completed install can remain fresh. Covers relative, HOME, BINDIR and LIBDIR destinations, changed destinations, modified outputs and deleted outputs.

Validation: compiler source check and behav_build_cache_install_paths pass; the regression failed before the fix with stale: output missing: $INSTALL_BINDIR/artifact. Native evidence: out/with-get-investigation/wo-install-cache-output-lldb.log. Fixes #1157 for newly built drivers; the frozen seed retains its old implementation.
LLDB in conan_curl_to_file received /tmp/with-conan-http-99953.json from conan_http_get. Windows native curl independently returned HTTP 200 then failed to open that missing drive-root directory. Use TMP/TEMP on Windows and TMPDIR on POSIX, with per-request scratch directories and cleanup. Capture curl, tar and source compiler output in real files and report it instead of redirecting to a POSIX-only null device.

Validation: compiler source check; offline Conan transport and recipe metadata tests. Transport covers spaces, successful reads, failed downloads, cleanup and an unusable temporary directory. Windows-only unset-temp coverage runs in CI. Evidence: out/with-get-investigation/conan-http-temp-lldb.log and windows-bzip2-native-download-text.log. Refs #1162.
Add isolated test-channel diagnostics for the exact Mesa DLL bytes copied through ToolFs by the pinned evaluator. Preserve original and copied artifacts and compare their hashes, sizes and file formats. The same action preserves all bytes under the Darwin pinned seed in native and interpreted modes; Windows evidence is still needed.

Validation: local copy action on the 56 MB x64 Mesa DLL, SHA-256 equal in both modes; tools/bump_seed_pins.w --check passes.
Windows native dumps stop in ci_collect_object_macro_values while copying a 580692-byte prefix at macro 15517 of 33367. Append table entries with builders. Native Darwin debugging additionally identified c_import_decode_escapes +472 copying each accumulated inline header and macro_source_line_from_cursor +216 reopening and scanning the entire header per definition. Decode with a builder and read each logical definition directly from Clang-owned contents and offsets.

Splice C backslash-newline before parsing a macro definition: LLDB observed an unspliced continued IDENTITY macro entering macro_session_add_from_define_line, while the single-line spelling passes. Cover LF, CRLF, split names/directives and the last line without a newline.

Validation: compiler source check, standalone bootstrap bridge, stage1 build, eight existing macro regressions and the new source-lines regression. Cold 33000-macro C import improves from 45990.103 ms to 326.392 ms. Large dependency-table fixture awaits the full stage chain. Native evidence is recorded in docs/with-get-release-investigation.md and out/with-get-investigation/macro-source-read-symbol-lldb.log. Refs #1163.
Relative copies preserve all bytes under both Windows seeds. Also exercise the external absolute path actually supplied by the UAT. A local pinned-seed LLDB trace resolves D:/a/_temp/mesa/opengl32.dll as <project>/D:/a/_temp/mesa/opengl32.dll, and the unchecked read then writes a zero-byte success. Preserve relative and external-path outputs separately. Refs #1164.
Native and interpreted ToolFs copy/read_binary now check read status before writing. Missing or directory sources fail and preserve existing destinations; readable empty and binary files remain valid.

LLDB shows the old unchecked reader returning length zero to eval_toolfs_capability_method for missing.dll. Windows run 35202995832 reproduces a zero-byte Mesa DLL under both pinned seeds for the external drive path. Stage2 passes the sixteen-case matrix and exact 58 MB DLL copies; the seed accepts the declared project-relative UAT input.
The implicit Ok aggregate in lower_fn_with_sig replaced its result operand
without consuming it, so the body frame freed an owned if/match join payload.
The allocator address trap observes source_yaml_scalar freeing the returned
buffer; LLDB at lower_fn_with_sig+6224 observes the missing consume at the
aggregate assignment (result-tail-wrap-live-lldb.log).

Consume that operand before body cleanup and retain returned strings, vectors,
and aggregate payloads across subsequent allocations in the regression.

Verified seed-driven full build, fixpoint, all tests, and last-green; compiler
audit: 2,528,140 facts and zero violations; move audit: 15 PASS, zero DIFF;
drop audit: 136 PASS, zero regressions; stage2 regression: zero allocator leaks.
The validator blind spot is separately tracked in #1170.

Fixes #1169
Windows bzip2/libcurl native dumps show repeated linear scans through the
1,120,240-byte macro registry during constant initializer translation.
Use keyed value/miss maps and a per-session last-definition index. Expand
private dependencies before C expression parsing for imports as well as
migration, preserving precedence and raw bitwise-or values.

Proof: ci-35205173022-{bzip2-lldb,macro-lookup-disassembly,lookup-memory}.log;
macro-private-expression-return-lldb.log observes the omitted value branch.
Validation: seed-driven build, fixpoint, full test suite and last-green;
compiler audit 2,528,011 facts with zero violations; expanded 33,000-macro
regression and six related fixtures; actual Darwin bzip2/libcurl UAT runs.
Native Windows UAT remains required before closing its timeout finding.
The ordinary cc link path forced -fuse-ld=lld, making clean release hosts
depend on a separately installed LLVM linker. Retain platform-compatible
flags and leave compiler/cross LLVM link plans intact. Add a fixture whose
PATH contains only cc, as, ld and nm.

Native GDB at with_exec_argv proves the injected flag; strace proves the
missing ld.lld lookup. Native Linux arm64 full build, stage1/stage2 clean
PATH fixture and release one-liner pass. Missing GL/X11 errors give the
package instructions; the unchanged program links after provisioning.

Fixes #1167
COFF .lib files use their literal basename; only Unix library lookup strips
the lib prefix. The OpenSSL package contains libcrypto.lib and libssl.lib,
but conan_library_name_from_path returned crypto and ssl.

Native LLDB proves the wrong name.slice(3, ...) return at ConanClient.w:543.
The 12-case library-name matrix passes, covering COFF and Unix names.
Real Windows package UAT remains part of release verification.

Fixes #1171
ehartford added a commit that referenced this pull request Sep 19, 2026
…ort speed, Conan selection, no OpenSSL UAT (#1209)

* Link the user's libraries as one group on ELF targets

GNU ld and lld resolve static archives left to right, once. A package's
libraries arrive in scan order (conan_scan_libraries sorts them, so crypto
precedes ssl), and both ELF link paths emitted -l<lib> in that order with no
grouping: libcurl's UAT failed on linux-x86_64 with libssl.a's references into
libcrypto.a undefined (OCSP_SINGLERESP_get1_ext_d2i, CT_POLICY_EVAL_CTX_*;
Release run 35388740596). ld64 is order-insensitive, so darwin linked.

The user's libraries are now wrapped in --start-group / --end-group on the
compiler-driver path (-Wl, spelling) and on the direct lld plan. Ordering by
the package graph would fix OpenSSL but not a package whose own archives
depend on each other. Fixes #1193

* Embed clang 22's __float_*.h and refuse an unclosed header subset

clang 22 split its builtin float.h into __float_float.h,
__float_header_macro.h and __float_infinity_nan.h. cr_should_embed knew the
__stddef_ and __stdarg_ prefixes but not __float_, so float.h shipped without
its parts and any c_import that reached <float.h> failed with
"'__float_header_macro.h' file not found" (CoreFoundation.h does).

The embed action now scans each embedded header's #include lines and fails
when one names a builtin sibling the subset leaves out. With the prefix
removed it reports "float.h includes __float_header_macro.h" under the
pinned seed; with it, the scan is clean.

Fixes #1198

* Probe a header's macros in one parse and index declaration names once

c_import cost (macros + pointer uses) x header size:

- Every object macro of a non-system header that was not a plain literal
  got a libclang parse of the whole header to itself
  (ci_try_translate_object_macro_probe). On the Windows release legs each of
  those parses re-reads windows.h; `with run` of the bzip2 and libcurl UAT
  projects hit the 180 s limit. The minidumps CI kept show the main thread
  waiting on libclang's parse thread, or inside the scans below. All
  candidate macros are now probed by one parse, opened on first use. The
  parse no longer stops at the first error: errors are attributed to the
  probe line they sit on, and an error anywhere else voids every probe, as
  it did before. A macro that leaves a delimiter open is kept out of the
  batch and parsed alone, so it cannot swallow its siblings.
- ci_type_decl_name_exists, ci_record_definition_exists and
  ci_prepopulate_names scanned every declaration, allocating its spelling,
  per query. One pass per session now records which kinds of declaration
  carry each name (the pattern of ci_fn_decl_index_ensure).

Synthetic header, N typedef'd structs + functions + macros, check wall time:
N=1000/2000/4000 was 8/29/120 s, is 7/8/16 s (7 s is stage1's fixed cost).
The translated text of curl/curl.h, sqlite3.h, OpenGL/gl3.h, zlib.h,
bzlib.h, stdio.h and the synthetic header is byte-identical to the previous
compiler's.

* Key the materialized clang header cache by its contents

The embedded builtin headers are written once to
<cache>/with/clang-resource/<clang major>/ and a stamp file short-circuits
every later run. The directory name did not depend on what was embedded, so
a compiler with a different header set kept using the old directory: the
fresh release binary still failed behav_c_import_float_h.w with
"'__float_header_macro.h' file not found" against a cache written by an
earlier compiler, and every existing user would have after upgrading.

The directory is now <major>-<hash of the listing and every header's
bytes>, the identity ensure_clang_resource_identity_file already wrote.

Refs #1198

* Pick a Conan binary the toolchain can link

conan_find_matching_package took the first static package whose os and arch
matched. For openssl/4.0.2 on Windows x86_64 ConanCenter lists an msys2
clang 21 build before the msvc ones; it ships libcrypto.a, whose library
name is `crypto`, and the windows-msvc link failed with "lld-link: could not
open 'crypto.lib'" (release validation 35420376179). armv8 lists only msvc
builds, which is why that leg linked.

A package now also has to be a Release build when it has build types (an
msvc Debug build wants the debug CRT) and, on Windows, an msvc build. The
choice is a pure function over the search listing, tested against that
listing's order.

Fixes #1204

* Read float.h through C constants; show what a failed expectation saw

behav_c_import_float_h.w asserted FLT_RADIX and DBL_DIG directly. float.h
defines them as aliases of compiler builtins, and c_import does not probe a
system header's macros, so they are not With names; the test now reads them
through two C constants. With the content-keyed header cache it passes on
the release binary.

bs_assert_contains printed the needle and nothing else. Release validation
35423258758 failed on linux-x86_64 with "missing expected output for
build_w_workspace_bad_cwd: bad cwd prelink missing"; the same commit passes
that target on linux-aarch64 and windows, and the log holds no evidence of
what the command printed. The message now ends with the last 2000 bytes of
the actual text.

* Remove the OpenSSL release UAT

Eric, 2026-09-19: OpenSSL cannot be a UAT. Where Conan Center has no binary
it has to be built from source, and its build needs Perl; a release UAT must
not require installing Perl. `with get c.openssl` still works wherever a
binary exists, and a source build that lacks a prerequisite will name it.
libcurl's UAT stays: it validates `with get` resolving a requirement
(openssl, zlib) on the legs that have binaries.

* Parse an #include line without str.trim

CI, linux-aarch64: "action target 'embedded-clang-resource-source' failed
during comptime evaluation: str method 'trim' is not comptime-evaluable
yet". That leg's pinned seed evaluates this action at comptime. The line
parser now uses indexing, slice and starts_with only, like the rest of the
build layer.

* with get builds a Conan package from source when there is no binary; with cc (#1208)

* Add `with cc`: clang's driver linked into the compiler

with get has to build a C library when no binary exists for the platform
(ConanCenter publishes no Linux armv8 binaries at all), and the toolchain
does not trust a system compiler. LLVM's backends are already in the binary;
the four objects of clang's driver tool (lib/libclangMain.a in the SDK) add
clang_main, called through one extern. The builtin headers come from the
embedded resource dir. A multi-job compile re-executes `with cc -cc1`
through llvm::ToolContext.

darwin-arm64 stage1: 107 MB -> 125 MB. Compiles and runs a C program,
cross-compiles an aarch64 ELF object, and a two-file compile exercises the
re-exec path.

* Build libclangMain into the SDK and alias clang_main per linker

The SDK build archives the objects of clang's driver tool (driver, cc1_main,
cc1as_main, cc1gen_reproducer_main) from the LLVM build tree into
lib/libclangMain.a (clangMain.lib on Windows), where the compiler link
already takes every clang archive, and the SDK package check requires it.

clang_main is a C++ symbol, so its spelling differs between the Itanium and
Microsoft manglings. The source declares one plain extern, with_clang_main;
the per-OS section of the compiler link aliases it (ld64 -alias, ELF
--defsym, COFF /alternatename) and forces the archive member in. The MSVC
name was checked with llvm-undname: int __cdecl clang_main(int, char **,
struct llvm::ToolContext const &). Verified by linking and running on
darwin-arm64; Linux and Windows need their SDKs rebuilt first.

* Parse a C port description

A port tells `with get` how to build a C library from source: where the
tarball is and its sha256, which files to compile, the include dirs and
defines, per-OS additions, and the library it produces. It is data; nothing
fetched is executed. Unknown keys, a missing field, or a malformed sha256 are
reported, not skipped.

* Build a C package from its port when Conan Center has no binary

`with get c.X` fell back to compiling every .c file in the recipe's tarball
with the system `cc`, and gave up on any recipe with patches, a configure
step or requirements — zlib already. It also could not be locked (the lock
wants conan_package.tgz), so it never completed for anything.

Now: no linkable binary -> the library's port (ports/<name>/port.toml, or
WITH_PORTS_DIR for a local registry). The tarball is checked against the
port's sha256, overlay files are written, the selected sources are compiled
by `with cc`, archived, and described by the same metadata.json a binary
package gets. The lock records source "port" and the tarball digest; a
restore rebuilds the same version or says what moved. A missing port is one
error naming the platform and the package. `with get --from-source` takes
this path on a platform that does have binaries.

First port: zlib 1.3.2. On darwin-arm64 `with get --from-source c.zlib`
builds 15 files into libz.a and the release UAT's zlib program links it
statically and prints "zlib UAT passed".

* Port bzip2 1.0.8 and sqlite3 3.53.4

Both build with `with get --from-source` on darwin-arm64 and the release
UAT programs for them link the result and pass. bzip2 compiles the seven
library files (not the bzip2/bzip2recover programs); sqlite3 compiles the
amalgamation with the features Conan Center's build enables.

* Add the clang driver archive to an SDK that was fetched without it

A packaged SDK from `with build :deps` predates `with cc`, and rebuilding
LLVM to add four objects is hours per platform. The driver needs only the
SDK's installed headers. `sdk-clang-main` (a dependency of stage1) fetches
driver.cpp, cc1_main.cpp, cc1as_main.cpp and cc1gen_reproducer_main.cpp from
the llvmorg-<version> tag, checks them against pinned sha256 digests (they
match the release tarball's), compiles them with the SDK's clang++ and
archives them as lib/libclangMain.a. It does nothing when the archive is
there, which is the case for an SDK built from source.

Run under the pinned seed on darwin-arm64: 89 s, and the compiler links
against the result. The same four compiles were done by hand against the
packaged linux-aarch64 SDK and define clang_main.

* Port raylib 6.0; a port can pass link arguments through

raylib builds as its own Makefile does for PLATFORM_DESKTOP_GLFW with the
bundled GLFW. macOS needs frameworks, which are link arguments rather than
-l names, so [link] gains link_args; GLFW's Cocoa sources are Objective-C,
which a [build.macos] cflags entry selects.

* Embed the host architecture's SIMD intrinsic headers

The embedded clang headers were chosen for parsing a header for c_import and
left every intrinsics header out. `with cc` compiles real C: raylib's
stb_image_resize2.h includes <arm_neon.h> and rtextures.c did not compile. A
port builds for the host, so the host architecture's intrinsic headers are
embedded (arm64 5.7 MB, x86_64 4.2 MB); other architectures' and Arm's
M-profile ones are not. The pinned seed generates the 5.9 MB module in 1.2 s
and the include-closure check passes.

With it, `with get --from-source c.raylib` builds libraylib.a on
darwin-arm64 and the release UAT's spiral program links it, opens its GL
window and prints "raylib spiral UAT passed".

* Replace per-package ports with a reader for Conan recipes as data

Eric: no special-case files per Conan package. The port format, its parser
and the four port files are gone. What decides how a package builds is the
package's own build system; what a source build needs to know generically is
in the recipe Conan Center already publishes, read as data and never run:

- conandata.yml: the version's tarball URL (first of a mirror list), sha256
  and patch files.
- conanfile.py: `self.requires(...)`, `default_options`, and the
  `tc.variables[...] = <expr>` assignments, evaluated when the expression is
  a literal, the version or one of its components, the source folder, or a
  boolean option's default; anything else is listed as unknown.

Against the live recipes: zlib, bzip2, sqlite3, libcurl and raylib all yield
a source URL and digest and 3/4/29/31/16 known CMake variables, with
0/0/7/8/2 unknown — every unknown is an expression over option defaults or
platform settings, the next thing to evaluate. openssl has no CMake build.

`with cc`, --from-source, the header fixes and the sdk-clang-main target
stay. The source build itself is a stub that says so; the lock's "port"
source is kept for the entry it will write.

* Evaluate a recipe's expressions against its option defaults and the host

A recipe decides its requirements and CMake variables with Python
expressions over options and platform settings. With every option at its
declared default and the host as the platform, the subset recipes use has a
value without running anything: literals, ==, !=, in / not in, and / or /
not, the conditional expression, str(), bool(), .replace(), get_safe(),
is_apple_os(), Version(self.version).major, self.settings.os/arch/build_type.
`shared` is always False. if / elif / else chains around `self.requires`
are followed; a requirement under a condition that cannot be evaluated is
reported as undecided, and a variable whose value cannot be known is named.

Against Conan Center's live recipes on Linux and macOS: zlib, bzip2,
sqlite3, libcurl and raylib resolve every CMake variable (3/4/33/39/18) with
none unknown, and their requirements (libcurl: openssl, zlib; raylib: glfw,
opengl/system) with none undecided.

* Apply a recipe's patches without a patch program

A unified-diff applier for source builds: -p1 paths, several hunks per file,
hunks located at the stated line or the nearest exact match, CRLF sources,
new files. A hunk whose context is not there, a target that is not in the
source, and a deletion are errors that name the file.

* Build a Conan package from source when Conan Center has no binary

`with get c.X` on a platform with no linkable binary (every package on
linux-aarch64), or with --from-source:

1. conandata.yml gives the archive, its sha256 and the patches; the archive
   is downloaded and checked, extracted (tar; unzip for a zip under GNU
   tar), and the patches applied by ConanPatch.
2. conanfile.py gives the requirements, which are installed first (a
   version range asks for the newest release), and the CMake variables;
   both only under the `if`s that hold for the default options on this
   platform. An assignment under `if self.settings.os == "Android"` set
   raylib's PLATFORM to Android before the conditions were honoured.
3. The project's own CMakeLists.txt, or the one the recipe exports for it,
   is configured and built by cmake and ninja with `with cc` as the C
   compiler and `with ar` / `with ranlib` as the archiver, static, Release,
   installed into the dependency directory. The build keeps going past a
   test program that does not link; the install step is what must succeed.
4. The installed tree is scanned by the code that scans a Conan binary, and
   the lock records source "built" with the archive's digest; a restore
   rebuilds the same version or says the recipe's digest moved.

What the machine lacks is named before anything is downloaded: cmake and
ninja (PATH, or WITH_CMAKE / WITH_NINJA), an unreadable archive format. A
package whose build is not CMake says which build system it is (OpenSSL:
"its own Configure script, which needs Perl").

`with cc` passes the macOS SDK c_import resolves when none is named.

darwin-arm64, no package-specific line anywhere: zlib 1.3.2 (one patch),
bzip2 1.0.8 (the recipe's CMakeLists, 4 variables), sqlite3 3.53.4 (a zip,
33 variables), glfw 3.4 and raylib 6.0 (raylib requires glfw and
opengl/system) build; the release UAT programs for bzip2, sqlite3 and the
raylib spiral link them and pass.

* Close the embedded header set by inclusion; read the SDK the link reads

CI on #1208:
- linux-x86_64, windows-x86_64: "embedded clang header set is not closed:
  intrin.h includes intrin0.h". The x86 intrinsics were chosen by a name
  rule. The set is now closed by construction: starting from the rule's
  headers, every builtin header an embedded one includes is added until
  nothing new turns up.
- linux-x86_64: sdk-clang-main looked in .deps while CI's SDK is
  LLVM_PREFIX. It reads the prefix the compiler link reads.
- windows-x86_64: "'clang/Driver/Driver.h' file not found". A packaged SDK
  has no headers, so the driver cannot be compiled against it. That case is
  now one error saying the SDK predates `with cc` and must be republished.

* Link without clang's driver when the SDK predates `with cc`

The published SDK assets have libraries and tools but no LLVM or clang
headers, so the driver archive cannot be built against them, and every CI
leg failed at sdk-clang-main. Rebuilding LLVM for five platforms happens on
machines this branch cannot reach, so the compiler has to link against the
SDKs that exist.

sdk-clang-main records what the SDK has (linked / absent). From that one
marker: the link aliases with_clang_main to clang_main, or to a stand-in
(with_alloc) that is never called; and the generated clang resource module
says embedded_clang_driver_linked(). `with cc` and a source build check it
and report "this build of `with` has no C compiler: the LLVM SDK it was
linked against predates `with cc`". A platform gains the feature when its
SDK is republished with the archive (build/sdk.w makes it when an SDK is
built from source).

Telling the two apart by address does not work: LLVM folds a comparison of
two distinct function symbols to "not equal", the stand-in was called, and
`with cc` exited 224 with no message.

Verified on darwin by hiding the archive and the headers: the compiler
links, `with cc --version` reports the missing compiler with exit 127; with
them back, it is clang 22.1.6 again.

* Fetch the clang driver sources with curl

CI, linux-aarch64: that leg's SDK does have headers, so sdk-clang-main went
on to fetch the driver sources, and its HTTPS helper — a With program built
by the pinned seed — does not link there ("undefined symbol:
with_vec_append_bytes"). `with get` already downloads with curl; the four
files are checked against pinned sha256 digests either way. The archive's
existence is tested by host path, since the SDK prefix is now the absolute
one the link uses.

---------

Co-authored-by: Eric Hartford <[email protected]>

---------

Co-authored-by: Eric Hartford <[email protected]>
ehartford added a commit that referenced this pull request Sep 20, 2026
…piler crash, survey running through failures, three migrator bugs, an unchecked promotion) (#1219)

* `?` over a Unit payload extracts nothing; the verifier checks enum payload reads

`step()?` where step returns Result[Unit, E] crashed the compiler in LLVM
(exit 133, DataLayout::getTypeSizeInBits under Codegen.mir_eval_operand),
on every compiler back to the pinned seed.

lower_question_mark_value read a Unit payload type as "no type known" and
fell back to the scrutinee's type, so the pass path declared the payload
place as the whole Result:

    _5: ty405 = move _3<as v0>.f0     // ty405 is Result[Unit, str]

and codegen built a load of the variant's real, unsized, field. Unit is an
answer there, not a missing one: the pass path now goes straight to the
join and the expression is unit.

--validate-all said ok over that body. mir_validate_place_type returns the
type the lowering declared for a place and never compares it with what the
projections yield, so a wrong declaration vouched for itself. A use of an
enum payload (a field under a downcast) now has to agree with the variant's
payload type; mir_test_enum_payload_read builds the bad and the good read
by hand and checks both verdicts. validate-all over src/main.w stays ok.

Option[Unit] is not covered: a function returning it does not compile at
all (#1218).

* Survey keeps going past a failure, never through one

Survey is the default since --fail-fast became the opt-out, and it skipped
only test-green and last-green by name after a failure. Every other target
still ran when its dependency had failed: zlib-promote ran after zlib-build
and zlib-test failed and replaced lib/std/zl with a corpus that did not
compile.

A target whose dependency failed or was skipped is now skipped, named with
the dependency that stopped it, and counted as a failure of the run, so the
skip carries through Groups and chains. An unrelated target still runs.

* migrate: FILE pointers in bodies, `*array`, array parameters; std.libc gains fseek, ftell, remove

Found migrating zlib's contrib/minizip. Nothing re-migrates a corpus in the
battery, so the first had sat on main since #1151.

- A `FILE *` local or cast inside a body became `*mut __sFILE`, a system
  record the migrator never emits (minigzip stopped compiling). #1151 taught
  the bridge's string translator that a reserved-spelled system record
  behind a pointer is c_void; bodies are typed by the structural builder,
  which never asked. It now asks the same rule
  (with_ci_type_is_reserved_system_record), and the test covers parameter,
  field, return, local, initialised local and cast.
- Unary `*` on an array dereferenced the array value ("cannot dereference
  non-pointer value"; mztools' READ_8(header) over char header[30]). C decays
  the operand first: decay_deref_operand, at both places a dereference is
  built. A reference to an array-spelled parameter is left alone: libclang
  reports the written array type for it, and it is already a pointer.
- A constant-array parameter (`int v[4]`) was bound by value as [4]i32, which
  no caller's decayed argument fits and which is the wrong ABI for a
  c_import of such a function. C adjusts it to a pointer to the element;
  translate_parameter_type does the same.

std.libc: fseek and ftell are With functions over a 64-bit seam (fseeko and
ftello on the POSIX backends, _fseeki64 and _ftelli64 on Windows, where C's
long is 32 bits), and the migrator rewrites the hosts' wide spellings
(fopen64, fseeko, fseeko64, ftello, ftello64, _fseeki64, _ftelli64) to them.
remove is C-standard and joins the extern list the surface check reads.

* zlib corpus: minizip's reader, repair and stream callbacks; every generated module is checked before promotion

contrib/minizip ships in the same zlib release, so it is part of the zlib
migration: ioapi, unzip and mztools join the staged sources and the bundle
as std.zl.ioapi, std.zl.unzip and std.zl.mztools. The writer (zip.c with
skipset.h) waits: zipAlreadyThere uses setjmp/longjmp as its out-of-memory
landing pad, there is no switch to compile it out, and the migrator refuses
setjmp (#1217). The two command-line programs and iowin32 stay out.

The pre-promotion check was a text scan, so a module no harness program
imports was first compiled by the bundle build, after promotion had
replaced the corpus (mztools.w did not compile). check-generated now
type-checks the generated bundle root, which imports every module, the way
the bundle build compiles it: the prelude off and --bundle-corpus, so the
corpus is read from the generated sources and not from the bundle interface
the compiler embeds, which predates the migration.

defs.w also picks up what main's migrator has emitted since the corpus was
last promoted (function-like macros as generic functions, unfolded constant
expressions, zlib_version left untranslated by #1191). std.fs gains chmod.

* verifier: the payload-read check runs only where the payload type is exact

The check added two commits back went red on user Try types
(spec_ss11_7_try_trait, behav_return_temporary_cleanup's user-try cases):
`validate(part)?` reads Continue's payload out of ControlFlow[str, i32],
declared i32, and the verifier derived str.

The lowering was right. mir_validate_enum_payload_type guessed that every
two-argument generic enum carries its arguments in variant order, which is
Result's declaration and not ControlFlow's (Continue(C) comes before
Break(B)). Nothing had relied on that answer until the new check did.

The positional rule is now Result's alone (the module records Result's
symbol), and the payload-read check runs only for a plain enum or an Option
or Result instance: another generic enum's payload is a type parameter this
module cannot substitute, and an unknown is not a mismatch.

---------

Co-authored-by: Eric Hartford <[email protected]>
ehartford added a commit that referenced this pull request Sep 20, 2026
…s which part changed (#1225)

Every action's signature carried the fingerprint of the binary orchestrating
the build (:WITH:). Our workflow alternates orchestrators all day: the
iterate tier uses the installed compiler, the battery the pinned seed, corpus
promotion the release compiler. With the seed held fixed (WITH=src/main) and
only the orchestrator changed, --explain reported stage1, stage2,
link-compiler, the runtime objects and the bundle builds all "stale: action
signature changed": a full compiler rebuild, about 4.5 minutes, per switch.
(:zlib-promote spent 270 s rebuilding stage1, stage2 and link-compiler right
after a build had produced them.)

The orchestrator produces a target's output only when it compiles it itself:
the compile kinds, and an action with no `compiler=` (a workspace compile
runs in the driver's compiler). An action that names its compiler is produced
by that compiler; a tree compiler is already hashed by the stage-target block
and `compiler=seed` is the seed WITH names. Such an action now keys on the
seed (build_cache_producer_fingerprint). Go, Zig and Rust all key on the
producing tool, never on the build driver. With WITH=src/main driven by
src/main the signature text is unchanged, so seed-driven batteries stay warm.

The state file held the signature as one hash, so "signature changed" could
not say what changed. It now records each component's hash (target, producer,
action-code or build-graph, compiler-source, compiler) and the stale reason
names the ones that differ; WITH_BUILD_CACHE_TRACE=<target> prints them.

Evidence, two binaries with different sha256 (release 32543048…, stage2
0dbd11f3…) over one seed, after a build orchestrated by the first: stage1,
stage2, link-compiler, rt-core-object and zlib-wo-build are fresh under both.
libc-surface-check (no compiler=, so the driver is its producer) is fresh
under the first and "stale: action signature changed (producer)" under the
second. The pinned seed (v0.15.2.0) still disagrees with a current compiler:
it predates #1151/#1185/#1191's changes to this code and records no component
hashes; that ends at the next seed.

Co-authored-by: Eric Hartford <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

with get on clean Windows assumes /tmp and hides download failures as package not found

1 participant