Skip to content

with get follow-ups that missed #1191: ELF link group, float.h, c_import speed, Conan selection, no OpenSSL UAT - #1209

Merged
ehartford merged 9 commits into
mainfrom
with-get-followups
Sep 19, 2026
Merged

ehartford merged 9 commits into
mainfrom
with-get-followups

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Seven commits that were pushed to with-get-release-uat-rebased after #1191 was merged (05:02Z) and so never reached main. Cherry-picked onto main unchanged.

On the old branch these passed the full battery and the darwin :release-uat (before the last, build-layer-only commit). Battery on this branch (main now also has #1194, #1202, #1205, #1206, #1207 — the last two merged before their batteries ran, so this run is also main's): build, fixpoint, :test-with-audits, :move-audit, test-green, last-green, :release-uat — running at the time of opening; I will update this line.

Eric Hartford added 7 commits September 19, 2026 01:38
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
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
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.
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
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
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.
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.
Eric Hartford and others added 2 commits September 19, 2026 02:31
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 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]>
@ehartford
ehartford merged commit 43db527 into main Sep 19, 2026
1 of 5 checks passed
@ehartford
ehartford deleted the with-get-followups branch September 24, 2026 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment