Conceptio › Archive › arXiv CS
arXiv CS open access

Meta Build Systems as Logic Programs

Alex Reinking · arxiv_cs
arXiv CS · Papers
Open Source ↗Direct PDF ↓
software-architecturesoftware-engineeringtesting
Meta build systems such as CMake, Meson and Bazel derive command graphs from project descriptions, user choices and machine facts. Imperative scripts, search paths and special cases make routine decisions interact poorly: search order can choose compatible packages without an explicit project choice
Conceptio Open Archive

Analyze & explore related research in Conceptio

Connect this record directly into your research workflow or AI agent. Explore citations across open repositories, query full text, and export structured proof bundles.

Meta Build Systems as Logic Programs

arXiv:2611.17672v1 [cs.PL] 13 Nov 2026

ALEX REINKING, Adobe Research, USA Meta build systems such as CMake, Meson and Bazel derive a build’s command graph from project descriptions, user options and facts about the machine, reconciling what a project requires, what its dependencies contribute and how the user wants it built. Because existing systems scatter this logic across imperative scripts, search paths and special cases, routine decisions interact poorly: search priorities can resolve compatible packages without an explicit project choice, authors hard-code flag preferences that packagers must patch out, and cross-builds require manual annotations or nested build trees for tools run during the build. Our central insight is to express configuration as relational inference: objects follow from sources, flags and libraries from dependencies, and language standards from transitive requirements. We introduce buildlog, a meta build system whose stratified, logical core isolates the build derivation from impure environmental probes. We treat ambiguity in toolchain or package selection as an error, and provide a tool to explain any derived fact from its provenance. When cross-compiling, buildlog infers the necessary build-machine configurations through simple use of a program in the definition of a build rule. Author constraints and user preferences are modeled as distinct input relations, and their separation is statically checked. Libraries can ship domain-specific compilation rules to their consumers, including Qt’s moc/rcc rules, and installed and built libraries are described by the same facts. We evaluate buildlog on eleven case studies of ten projects, validating the ported configurations through execution and artifact checks while reporting remaining flag differences and platform limits. In our largest study, Halide, generators link an LLVM-based compiler and run during the build to emit WebAssembly or Android code; where CMake requires nested builds, buildlog derives the build-machine and target-platform configurations in a single graph. A supporting formal account establishes termination, within-round probeorder independence and agreement between fresh and validated cached runs under explicit finiteness and probe obligations. The results show that confining impurity to fact discovery and treating the rest of configuration as logical entailment can replace a collection of special cases with a small, uniform and explainable semantics. CCS Concepts: • Software and its engineering → Software configuration management and version control systems; • Theory of computation → Constraint and logic programming. Additional Key Words and Phrases: build systems, meta build systems, Datalog, provenance, configuration, cross-compilation

1

Introduction

A build system runs commands, but something must first decide which commands to run. A meta build system such as CMake, Meson or Bazel computes this command graph from project descriptions, user choices and facts about the machine, specifying which artifacts to produce, with which flags and libraries, and for which platform. An executor such as Ninja [40] or Bazel’s runner then executes the graph; we study the configuration step before it, deriving a graph whose decisions are explicit, explainable and properly divided among the parties to a build. Most of this computation is relational inference: objects follow from sources and target configurations, a library’s usage requirements (the flags and libraries its consumers need) propagate along public or private dependencies (§2.2), and a target’s language standard follows from its own and its dependencies’ minimum requirements. In effect, the configured graph is a logic program’s model. Existing systems leave that program implicit, mixing derivation with imperative probes, search and ad hoc policy, and three recurring problems follow. Selection can hide a policy decision. When several packages or toolchains are compatible, CMake’s find_package takes the first viable package in search order [32] and Bazel selects the first compatible registered toolchain [67]. Although these first-match priorities are documented, they resolve ambiguity by search order rather than requiring an explicit choice among candidates.

2

Alex Reinking build-machine side

generator (C++)

compiler

target-platform side

executable for the build machine

run on the build machine

writes

machine code for the device

linker

app for the device compiler

app’s own code

Fig. 1. How an app uses Halide. A C++ program (a generator) is compiled for and run on the build machine; the machine code it writes is linked into the app by the target-platform toolchain. Halide’s CMake build configures the two sides separately; buildlog derives both configurations in one graph.

Constraints and preferences become entangled. Because build languages do not separate author constraints from user preferences, authors routinely hard-code both. LASzip’s build fixes -std=c++17 [34] when C++17 is only the minimum its code needs, forcing vcpkg and Conan to patch it out instead of letting the standard follow from the target and its dependencies (§3.2). More broadly, Linux and BSD packaging policies require undoing upstream rules that override user compilers, flags or dependency choices (§2.3). Programs run during a build need special handling. A Halide [55] cross-build compiles a C++ generator linked to Halide and LLVM, runs it on the build machine, and links its output into an app for the target platform (Figure 1). Although the generator’s execution platform follows from the step that runs it, Meson and Bazel require explicit tool annotations (native: true and cfg = "exec" [63, 74]), and CMake’s single-toolchain-per-tree limit forces separate build trees and nested configuration—even to cross-build libHalide itself from macOS to AArch64 Linux. Although all three problems concern decisions about one command graph, existing systems lack a shared account of how that graph follows from its inputs, and prior formal work models graph execution or CMake scripts rather than treating the configured graph as a logic program’s model (§7). We make that program explicit in buildlog, a meta build system whose stratified Datalog core is evaluated by Soufflé [27] from TOML or Datalog specifications and paired with a Python driver that emits Ninja. Two principles guide its design. First, separate discovery from derivation. Plugins probe the machine only for environmental facts the program requests, and pure rules derive the build from their answers; ambiguous toolchain or package candidates are errors listing the alternatives, not implicit selections. Second, each party states its own decisions. Authors state constraints and users state preferences through distinct, statically checked input relations, while libraries ship domain-specific consumer rules (such as Qt’s moc/rcc rules) using the same facts for installed and built code, and every derived fact has a provenance proof. Running a compiled program in a build step likewise entails its build-machine configuration, so buildlog derives Halide’s generator and target product in one graph; §5.1 validates a libHalide cross-build against CMake on a 32-test subset. Our contributions are: • A shared configuration model (§3) unifying library consumer rules, inferred tool configurations, checked author/user inputs and provenance in one composition (§3.1). • A supporting formal account (§4 and Table 1) proving termination, within-round probe-order independence and validated-cache agreement under stated obligations, mechanized in Lean. • Eleven case studies of ten projects (§§5 and 6), comparing builds, generated commands and configuration costs against CMake, Meson and Bazel.

Meta Build Systems as Logic Programs

2 2.1

3

Background and Motivation Build Systems and Meta Build Systems

Following Mokhov et al. [47], a build system brings a store of keys and values up to date using a task description. A meta build system computes that task graph from build code, user choices and environmental probes. We study this latter computation, whether its executor is separate (CMake, Meson, GN) or integrated (Bazel, Buck2, Pants). The author writes the build code; the user, such as a packager, invokes and configures it. Some inputs are hard constraints only the author can know; others are preferences of the user (§2.3). Conflating them forces users to become authors. 2.2

The Closure at the Core

Consider a library z exporting an include directory, a library png that depends publicly on z, and an executable app that depends privately on png. In CMake: add_library(z ...) add_library(png ...) add_executable(app ...)

target_include_directories(z PUBLIC include) target_link_libraries(png PUBLIC z) target_link_libraries(app PRIVATE png)

app receives z’s include directory and links png, then z. CMake defines this through the transitive closure of INTERFACE_LINK_LIBRARIES [29]. As Datalog: interfaces propagate through public edges; linking follows all edges. sees(t, d) :- dep(t, d, _). sees(t, e) :- sees(t, d), dep(d, e, "public"). links(t, d) :- dep(t, d, _). links(t, e) :- links(t, d), dep(d, e, _). use(t, k, v) :- own_use(t, k, v). use(t, k, v) :- sees(t, d), iface(d, k, v). compile_arg(o, v) :- object(o, t, _), use(t, "include_dir", v).

Here use combines own properties (own_use) and public dependency properties (iface); object relates objects to targets. In buildlog a shared library hides its private dependencies from consumers’ links (§3.3). GN [73], Bazel [62] and Buck2 [70] propagate according to the same visibility model, but none as a logic program. §B1 compares twelve build and meta build systems along eleven axes, from discovery to compatibility. 2.3

Where Meta Build Systems Depart from Logic

Today’s systems give the following policies separate mechanisms; a logic program expresses them as rules over shared relations. Discovery is entangled with derivation. CMake’s find_package and try_compile run in imperative control order, with find_package taking the first viable package file [32]; Bazel likewise selects the first compatible toolchain for each execution platform [67], so the outcome can depend on a search order the project never states. In buildlog, probe requests are relations over finite domains, separating the rules that ask questions from the probes that answer them (§3.1). Properties are untyped strings. CMake computes the closure with generator expressions [30]. Targets are a distinguished type there, but their properties are strings, and mistakes in them are 1 Lettered sections and S-numbered figures and tables are in the supplement.

4

Alex Reinking

silent: zlib 1.3.2 writes [87] $<$<BOOL:NOT:${HAVE_FSEEKO}>:NO_FSEEKO>, which tests the nonempty string "NOT:1" and is always true. In a logic program a condition is a term over declared names, and buildlog reports a condition it does not know as an error. Imported libraries and build-time tools are special cases. CMake distinguishes imported from built targets and generates no rules for imported libraries [28, 33]. Halide’s generated libraries therefore need object-as-source conventions and extra ordering targets [24]. Build-time tools also need explicit declarations (Bazel’s cfg = "exec", Meson’s native: true [74]), although their execution platform follows from how they are used. buildlog models built, imported and generated artifacts uniformly and derives tool configurations from typed uses (§3.5). Configurations and compatibility are second-class. CMake has one toolchain per language per build tree (§1), and Debug and Release are privileged names. Compatibility has no algebra, with CMake’s compatible interface properties [31] the clearest exception. In buildlog a configuration is a value like any other and compatibility uses declared lattices (§3.2). Third-party library logic is adopted into the core. CMake absorbed Qt’s consumer-side logic as AUTOMOC [50] and added imperative deferral for Qt 6 finalizers [10, 82], though code deferred later can still mutate the target. Meson absorbs dependency-specific logic as a matter of policy [76]: its core special-cases 38 dependencies [75] and ships built-in Qt, GNOME and CUDA modules [77]. Rejecting user-defined functions to keep build files simple merely moves reusable abstraction into Meson itself, relocating complexity rather than bounding it. Restricted computation need not exclude abstraction: buildlog’s finite, stratified rule compositions let libraries and projects supply their own reusable build logic. In a logic program the model is a fixpoint, so a rule that negates or aggregates over a target’s sources sees all of them, and in buildlog Qt’s rules ship with Qt. Overridden choices are defects. Packaging policies protect user choices: FreeBSD requires respecting user compilers and flags [72, Sections 13.8–13.9], Gentoo rejects upstream -Werror [19], Fedora requires system rather than bundled libraries [15], and vcpkg patches builds lacking static/shared selection [44]. These policies often require build-script patches, as vcpkg maintainer Robert Schumacher recounts [56]. In buildlog, user preferences enter through distinct, manifest-checked relations that author rules cannot silently override (§3.3). 3

The Design of buildlog

Figure 2 shows the three stages of a configure run, which computes the command graph for one or more requested configurations (each a target platform paired with settings such as optimization and linkage). Preparation first catalogs package metadata and rules within declared dependency roots. Discovery is impure: probes ask the environment questions (does this compiler accept C++20? which library exists under this sysroot?) and return the answers as facts. Derivation is pure: a stratified Datalog program over the author’s specification, the user’s files and command line, and the probe answers, whose model contains the build graph that a thin translator emits as Ninja. A layer pairs Datalog rules with a manifest declaring which relations it reads, extends or accepts as input; layers perform no environment I/O. The core and installed plugins supply layers plus Python probe kinds (families of environmental questions) and metadata providers, which enumerate package layouts within declared roots and use importers to decode pkg-config, CPS or CMake exports. Libraries can also ship rule packages—a manifest, layers and facts, with no impure code—and the loader guards each package’s module to separate its declarations from its effects.

Meta Build Systems as Logic Programs

5

prepare bounded available metadata 𝑉 and rule union; compose 𝑃 = core ∪ plugins ∪ rule packages; check 𝑀𝑖 = 𝑀𝑃,𝑉 (𝐴, 𝑈 , 𝐸𝑖 ), stratified Datalog (pure) 𝐴: author

options, requested targets; available metadata

spec, package facts

when certified: target requests read 𝐴, 𝑈 , 𝑉

probes (impure)

𝑈 : user

bindings, conditions; needed closure; tool configurations

compile tests, run tools, resolve paths; guarded reads; cached by fingerprint and watches

user files, presets, command line

probe requests req𝑘 ⊆ dom𝑘

𝑅𝑖

platforms, toolchains, path answers; reads 𝐸𝑖 𝐸𝑖 : environment probe answers

𝑅𝑛 = ∅

actions; errors translator emit : sort, serialize

build.ninja answers, read from a snapshot of 𝐸𝑖 , become 𝐸𝑖+1

Fig. 2. How buildlog configures a build. Preparation fixes the composed program 𝑃 and available metadata 𝑉 before inference, with no package-driven back edge. When full-program decisions are answer-independent, 𝐴, 𝑈 , 𝑉 fix explicit target requests (package-use guards can otherwise depend on discovery), while discovered facts extend the needed closure (dotted). Each round evaluates 𝑃 to 𝑀𝑖 and answers new probe requests 𝑅𝑖 against a snapshot to form 𝐸𝑖+1 . Shaded boxes perform environment I/O.

3.1

Configuring Is Deriving

A target request asks for a build target in a configuration. A target is needed if requested, or if a needed target links, loads or runs it; this transitive dependency relation is the needed closure. In Figure 3, for example, requesting libfribidi requires its generated tables, whose action runs gen-bidi-type-tab and makes that program needed in the build-machine configuration; Ninja later executes these derived actions, whereas probes run only during configuration. Packages follow a distinct three-stage progression: available definitions participate in name resolution, binding selects a definition and exposes its declarations, and use enables build effects for needed consumers, leaving available but unused modules dormant rather than invisible. Suppose the user’s prefix contains Qt: preparation makes QtCore’s definitions available and composes its rules before probing, so a condition can ask whether QtCore exists without triggering a build. Binding then resolves each target name (source declarations and aliases take precedence, and a demanded ambiguous binding is an error), while only a needed consumer enables effects such as moc actions (§3.5); unused modules contribute neither actions nor target requests, and environmental probes never add new package rules. Each discovery round evaluates the composed program and reads probe requests from its model (Figure 2). Unlike a target request, a probe request asks an environmental question, such as whether the selected compiler supports a needed language standard. The driver checks that each request lies in its declared finite domain, runs the round’s probes against a single answer snapshot, and adds their results for the next round. All rounds evaluate the same prepared program and metadata, and only preparation and probes perform environment I/O (§3.8). Authored target-request and target-kind conditions may test options, not probe results, though package-use guards remain a separate source of activation (§3.4). Within discovery rules, a guarded answer read requires the matching probe request in the same rule body, making any retained answer

6

Alex Reinking

whose probe request disappears inert in that rule. By convention, req_ names probe requests and res_ their answers; these core rules request imported files’ architectures and guard their reads: // c: config; f: file; p: platform; x: format req_file_archs(f) :- import_file_in(_, f). covers(f, p) :- res_file_arch(f, a), req_file_archs(f), platform_cpu(p, a). archs_known(f) :- res_file_format(f, x), x != "unknown", req_file_archs(f). error(c, f) :- import_file_in(c, f), config_platform(c, p), archs_known(f), !covers(f, p).

The error rule negates covers only after archs_known confirms the probe has answered. The loader inserts binding guards on package declarations and use guards on package effects, including fact payloads and disjuncts (§A.2.1). Because errors propagate to dependents only after the final round completes, discovery rules chain on positive “not found” facts rather than on failure. Given the probe answers, the stratified model is unique; within-round probe-order independence holds under the hypotheses of §4.2, and the why command reconstructs the proof of any derived fact from source and probe leaves (§3.7). 3.2

The Core and Its Layers

The model holds the whole configured build, down to the commands. The bottom of the core is a set of action relations, the only relations the translator reads: an action’s outputs, typed inputs, dependency file, arguments and Ninja flags. Arguments whose order matters form a set with before edges, sorted topologically with a lexical tie-break, so even a link line’s order is derived. The translator (about 330 lines of Python) derives nothing; the core checks one action per output, that every input exists or is produced, and that there are no cycles. Any layer or project can add actions directly; an action’s words are its command-line argument tokens. A raw action’s words are taken as written, checked for integrity but not inspected for tools. Everything above is a lowering into them, a design inspired by MLIR’s dialects [35]. A Halide generator lowers to libraries, libraries to objects and link items, and those to actions, so a provenance explanation follows a derived flag through every lowering level (§3.7). The next layer knows no language. It holds targets, dependency edges with a visibility, and properties that propagate along edges as in §2.2. Edges and properties may have conditions. A condition can compare a discovered version, such as cxx.version >= 13; reads of discovered values must be guarded. Every property key declares an algebra, most of them sets. A lattice key’s value is the join of the values a target states and inherits: needing C++20 and depending on a C++17 library gives C++20, and a join the selected compiler does not support (probed) is an error blaming the target, configuration and compiler. Each setting key is declared by the layer that owns it, with finite values, a default and a tool policy, which says how the key changes for tools. The core declares optimization, sanitizer and linkage, and plugins add more (e.g., the Python plugin adds the interpreter), so release, debug and an address-sanitized build are declarations, none privileged over other configurations. Every configuration 𝑐 has a tool configuration, in which programs that run during a build of 𝑐 are built: the build machine’s platform, with each setting rewritten by its key’s policy (tools are optimized, unsanitized, and inherit the linkage). In a native build whose product settings match the tool policy, the two configurations coincide and one target instance serves both roles, so the tool is built only once (Invariant 2). Platforms and toolchains are facts that plugins derive from probes. For each language, build platform and target platform, two candidate toolchains without a pin (an explicit selection) are an error; a pin specifies the whole toolchain key, since in a cross build “use gcc for C++” could mean the product’s compiler or the tools’. Native code (objects, libraries, executables, link closure and order) is language-neutral and in the core. The C/C++ plugin, buildlog-cpp, adds clang toolchain

Meta Build Systems as Logic Programs

7

config_decl = [["debug", "arm64-macos"]] request_all = [["libfribidi"]]

# the configurations the author supports # built in every configuration

[option.TOOLS] # an option: default off help = "build the command-line tools" [target.libfribidi] kind = "library" # linkage is chosen, not fixed by the author sources = ["lib/fribidi.c", "lib/fribidi-bidi.c"] public = { "cc.include_dir" = "src:lib" } gen_include = { private = [""] } # its generated files are on its own path [target.gen-bidi-type-tab] # a program; nothing says where it runs kind = "executable" sources = "gen.tab/gen-bidi-type-tab.c" [generator.bidi_type] # runs the program, captures its output owner = "libfribidi" # "2" below: fribidi's table compression depth run = ["gen-bidi-type-tab", "2", "${src:gen.tab/unidata/UnicodeData.txt}"] stdout = "${out:bidi-type.tab.i}" [target.fribidi-cli] kind = "executable" sources = "bin/fribidi-main.c" deps = { private = ["libfribidi"] } request_when = "TOOLS"

# decides what is built; may test only options

Fig. 3. A specification modeled on the fribidi study (the TOOLS option is ours); every TOML table desugars to core relations. The src: prefix resolves relative to the source root, and owner attaches the generator’s action to libfribidi, causing gen-bidi-type-tab to be built for the build machine.

inventory, C and C++ layers, C configure checks (header, symbol and compile tests), instruction-set knowledge, install rules and importers for pkg-config, CPS [71] and CMake’s export files. A Python plugin builds extension modules. A surface that desugars. Authors write per-subject tables in TOML (Figure 3). The loader desugars them into rows of the core’s relations and records the line that wrote each row, which explanations cite (§3.7); the tables have no semantics of their own. The surface does not hide the fact schema, which comprises every relation that the core and the loaded plugins declare. Any table can be replaced by the rows it stands for, and a project can add Datalog rules that write these relations, subject to the manifests’ ownership checks. The schema is the final lowering and the escape hatch, and project rules are how larger builds such as zlib-ng and Halide get abstraction. A target template also desugars to rows: those of a target with named parameters in its values ("src/arch/{isa}/impl.c"). Its instances are rows that rules could write; what the template adds is that rules can derive the instances, as ggml derives one per ISA level from the platform’s features, and each instance’s flags have provenance through the template line. Parameters may not depend on the needed closure, because they decide edges and sources.

8

Alex Reinking

default_linkage = [["codec", "shared"]] # a preference: the user may change it linkage_prop = [["codec", "static", "cc.define", "CODEC_STATIC", "public"]] [target.filters] kind = "library" sources = "src/filters.c" linkage = { require = "static", why = "registers filters from static initializers" } $ W=walkthrough $ buildlog configure -C build-default $W # libcodec.dylib, libfilters.a $ cat $W/user-static.toml library_linkage = [["codec", "static"]] $ buildlog configure --user $W/user-static.toml -C build-static $W # both .a $ buildlog why -C build-static --flag -DCODEC_STATIC \ --output viewer.c.o --leaves $W library_linkage("codec", "static") ← W/user-static.toml:1 linkage_prop("codec", "static", "cc.define", "CODEC_STATIC", "public") ← W/spec.toml:4 target_deps("viewer", "private", "codec") ← W/spec.toml:18 ... (8 more leaves) $ cat $W/user-shared.toml library_linkage = [["filters", "shared"]] $ buildlog configure --user $W/user-shared.toml -C build-shared $W error: user linkage contradicts the library's requirement: filters: the user's library_linkage asks for shared, but its author requires static (registers filters from static initializers); fix: drop library_linkage(filters, shared) or state static

Fig. 4. The author/user split on linkage, excerpted from a runnable project. Above the rule: the author’s statements. Below: the user’s files, three configures and one explanation; comments give the libraries built. W abbreviates walkthrough in source citations.

3.3

Authors and Users

Each layer’s manifest separates author inputs, such as targets, dependencies and defaults, from user inputs, such as toolchain pins, package locations, linkage and configurations. Authors and packages may supply the former; user files, user-selected presets and the command line supply the latter. Dependencies’ user facts are not inherited. An author-supplied user relation is an error unless listed under author_decides with a reason, which diagnostics quote. These checks do not ensure that arbitrary compiler or linker flags respect user preferences. Figure 4 contrasts an ordinary preference with a legitimate author constraint. The user overrides codec’s default linkage in one line, which the explanation cites (§3.7). By contrast, filters’ static initializers require static linkage. The author states that reason explicitly, and a conflicting user choice is an error that cites both sources and gives the fix. Three decisions that project authors commonly hard-code in build scripts show how this manifest split works in practice: library linkage, compiler warnings and header include order. Linkage. A built library’s linkage is a parameter, derived per configuration from, in order, a reasoned requirement, the user’s per-library and global choices (as CMake’s BUILD_SHARED_LIBS), the author’s default, and static; a configuration may ask for both. A usage requirement may hold for one linkage only (CODEC_STATIC in Figure 4), applied by a core rule, so no author inspects linkage. An imported library’s linkage is a fact, not a choice.

Meta Build Systems as Logic Programs

9

Warnings. -Werror is the user’s decision wherever the user chooses the compiler, because which code warns depends on the compiler. An author’s -Werror is an error unless the author decides it with a reason or the author’s facts fix the compiler. Include order. Include order can change the output, since the first directory with a header wins. A compile’s include directories fall into three classes: the target’s own (-I), every dependency’s (-isystem, so a dependency’s warnings are its author’s), and other system directories. Within a class they are a set, emitted in lexical order; where two hold a header of the same name, the author can state a priority (a cycle is an error). buildlog-cpp adds the compiler’s -Wshadow-header warning by default where the toolchain accepts it; the core does not diagnose a header in two directories or a symbol in two archives. 3.4

Options That Decide What Is Built

Options select target requests (TOOLS in Figure 3), target kinds or dependency edges. Because policies such as “build the CUDA backend if CUDA is found” (Meson’s auto) make the product vary by machine, buildlog permits only option tests in authored target-request and target-kind conditions, resolved from the user’s value or the author’s default: missing CUDA is an error, not a changed option, as is requesting or needing an option-disabled target (including from a package). Whereas the loader checks authored decision rules before inserting module guards, those guards can introduce probe-answer dependencies into packages’ target requests. Full-program answer independence for target requests and kinds therefore requires a further dependency restriction (§4.3) that loader acceptance does not certify; conversely, failing that sufficient audit implies neither a changed request nor an incorrect build. 3.5

Generators and Rule Packages

A generator’s run is a fact from which the core derives its outputs’ edges, owners and consumers. A generator runs a program that writes files. Its argument vector is a template whose words are literal text or typed placeholders: an output, a source, a file of an imported package, another program, or a list of words (Figure 3). The types tell the core which words are inputs and outputs, so edges, output ownership and provenance are derived; a program a word mentions untyped, or a script runs, is invisible to the core. The first word is a program, and that use alone makes it a build-time tool, built in the tool configuration; neither the program nor the generator is marked as a tool. An imported program’s platform comes from its package’s facts or a probe. A generator may itself be a template. Libraries can likewise ship and install the rules their consumers need (§3.6): Halide’s rules lower a generator into a library and header for C++ targets, a small DSL fixture exports a .dsl-to-C++ rule that downstream builds run (which CPS alone cannot carry), and two installed generator libraries compose in one consumer through ordinary runtime dependencies while a third available package in the prefix stays dormant (§C.6). Our Qt 6.11.3 packages import Qt’s exports and could be installed beside its libraries (116 lines total, 41 of Datalog). The rules below derive moc actions for listed headers of QtCore consumers, including through usage-passing edges, with their compile flags (... elides atoms): qt_passes(d, c) :- eff_dep(d, c, "Qt6::Core", v), v != "private". qt_passes(d, c) :- eff_dep(d, c, x, v), v != "private", qt_passes(x, c). qt_user(t, c) :- eff_dep(t, c, "Qt6::Core", _). qt_user(t, c) :- eff_dep(t, c, x, _), qt_passes(x, c). qt_input(t, f, "moc", "moc_") :- target_sources(t, f), path_ext(f, e), (e = ".h" ; e = ".hpp" ; e = ".hxx"), !qt_moc_exclude(t, f). qt_gen(t, c, f, k, cat(g, "/", d, x, s, ".cpp")) :- qt_user(t, c), qt_input(t, f, k, x), ...

10

Alex Reinking

action(o, "MOC"), action_run(o, 0, "", "Qt6::moc", "run"), ... :- qt_gen(_, _, _, "moc", o). action_arg(o, 20, "-D", v), ... :- qt_gen(t, c, _, "moc", o), use(t, c, "cc.define", v, _). action_arg(o, 30, "-I", v), ... :- qt_gen(t, c, _, "moc", o), use(t, c, "cc.include_dir", v, _).

Further rules compile each generated source into the target and run rcc on its resource lists. A rule lies in a higher stratum than the relations it negates and aggregates, so “after the target is fully described” (§2.3) holds by construction. Because dependency rules affect what is built, the lock (buildlog.lock) records content hashes for explicit packages, rule modules used in the final model and their plugins, while preparation observations track dormant modules (§3.8). Configure rejects hash changes until approved; unused modules stay out of the lock, and the lock itself never activates a package. 3.6

Imported and Built Libraries

A model records that a fact holds, not how the fact was obtained, so a library is consumed the same way whether it is built or installed: through facts about its targets, such as files, dependencies and usage requirements. A built library’s facts are derived; an installed library’s are loaded, and its targets are imported. The link closure and the standard’s join read the same facts either way. An installed library is a rule package: its manifest, its facts and optional rules. The facts can be Datalog, or an importer can decode them from a pkg-config, CPS or CMake export file, found by search or listed in the manifest’s imports. An upstream that ships only CMake exports can still ship a manifest and rules beside them, as our LLVM and Qt packages do. Unreadable metadata is an error when demanded. A package may assert only about targets in namespaces it owns, and sources that disagree are an error, never resolved by precedence. Installing reverses this: it writes down the facts that a consumer of the built library would derive. Datalog is the canonical export format. In buildlog’s own format the export is a file of ground facts, which Soufflé reads as it is, plus the project’s rule layers if the specification exports them; a downstream loads it like any rule package, pinned in its lock. Exports to CMake, CPS and pkg-config serve consumers of other tools. Their exporter spells each key in the format or declares it unspelled with a reason, and each lost key is surfaced to the user as a warning (pkg-config has no field for a C++ standard). Under §4.4’s conditions, a lossless export preserves the supported usage facts as a set; this is set-level usage preservation. Libraries loaded with dlopen are run-time dependencies: built in the calling program’s configuration, placed beside that program or each executable that links it, and passing no usage requirement or link item; only the Datalog export carries the requirement. 3.7

Explanations

The why command explains a fact by its proof relative to the configured model and the recorded probe answers; an explanation is not a log. It reruns the composed program on the final round’s input in Soufflé’s provenance mode, maps leaves to origins and prints the proof as a DAG that shares repeated subproofs. Negations, constraints and aggregate results are leaves checked against the model; other leaves cite their origin: a specification line, a user file, a package or a probe answer with its probe request (--demand explains that request). Because the loader records the line that wrote each desugared row, a leaf cites the TOML line, not the row, as the user file does in Figure 4. Because every layer lowers into the one below, an explanation can follow a flag from an action through the objects and libraries that entail it. A query may spell a flag as the Ninja file does. On the questions the studies’ authors asked, default answers take 16 to 52 lines (§C.7); the longest shows how zlib-ng’s AVX2 requires SSE4.2 down to SSE2, each step with its check, and a test asserts that no unrelated premise appears. §6.3 excerpts an answer through a lattice join and gives the behavior of why-not, which explains a missing fact.

Meta Build Systems as Logic Programs

3.8

11

Implementation

buildlog is a Python driver around Soufflé: 12,232 lines of Python and 2,989 of Datalog in the core, and 3,330 and 1,084 in the C/C++ plugin, excluding tests (Python by cloc; Datalog non-blank, non-comment). buildlog uses 23 Soufflé patches (about 1,500 added lines, tests excluded): 15 for provenance, 2 for serving multiple rounds in one process and 6 for per-run overhead. Timings depend on the last eight; each patch has a regression test. The patches pass Soufflé’s full regression suite (3,841 tests) and change no output of our programs. configure emits the Ninja file, check validates the model without emitting it, and test runs configured tests; why, why-not and query inspect the model without running probes. Determinism tests shuffle input facts and within-round probe order and require identical Ninja output. Preparation. Before probing, metadata providers follow includes and rule pointers within declared roots; their preparation certificate records the resulting filesystem observations (rather than provider correctness) and is rechecked before publishing a successful run. The loader composes the reachable Datalog union once, rejecting invalid or conflicting rules even if unused, whereas ordinary metadata errors wait until demanded; probes cannot extend this prepared scope (§A.2). Loader. The loader rejects private-relation violations, I/O, foreign functions and unstratified rules, reporting offending cycles. It verifies guarded answer reads and authored decision dependencies (§§4.2 and 4.3), while checking inserted module guards for declaration/use stratification rather than full-program answer independence. Rounds and cache. A single Soufflé process evaluates every round, and a guarded path probe resolves symbolic sysroot paths with ordered negative lookups. Cached outputs are reused when inputs repeat, and unchanged runs validate preparation, probe keys and watches without inference. Unfingerprinted probe kinds run on every configure unless the user states their answers. Refresh and regeneration. Compile checks key their arguments and validate stat watches on depfile inputs and compiler-reported search roots; directory watches are nonrecursive, not a complete record of negative or transitive lookups. Cache validity therefore assumes unobserved external and toolchain inputs stay stable until --fresh, which bypasses warm skipping, retained answers and cached results (§A.2). Ninja regenerates on specification, user-file or package edits; after probe-only changes, re-running configure revalidates keys and watches. Emission. The translator reads only the action and test relations. A model with errors deletes the Ninja file and fails, unless --keep-going turns errors of a target or action into failing edges; a loader, lock or probe failure stops earlier and leaves the old file. Copies, installs and configured files are emitted as built-in driver commands. 4

Formalization

Discovery can withdraw probe requests, so accumulating answers need not produce growing models. Under the stated hypotheses, guarded reads make irrelevant retained answers inert, supporting least closed answers and agreement between fresh and validated cached runs. Finite progress across declared domains yields termination, and per-round snapshots yield within-round probe-order independence. Table 1 separates checks from author obligations; §A gives the proofs. Mechanization boundary. Lean 4.35.0 (with bundled Std) mechanizes a finite abstraction: it proves answer inertness for finite ground guarded rules rather than verifying the loader’s translation, and its cache-agreement and answer-free-decision theorems take completed-phase and dependency certificates as hypotheses. A 201-entry source-correspondence test checks the core-rule transcription

12

Alex Reinking

Table 1. Assurance boundary. Runtime checks cover reached rounds, not all hypothetical answer sets. Detailed conditions and mechanization status are in Table S2. Responsibility

What it establishes or assumes

Loader

Origins/visibility, stratification, guarded reads, authored decision dependencies and error isolation. Domain membership, unique argument tuples, answer shape, cache confirmation, rule-union and observation checks. Finite evaluation and probe-request universes; returning functional probes; complete finite enumeration; sufficient cache keys and acyclic prerequisites. Abstract model/driver results and finite-graph closure; core toolchain, toolconfiguration and export-classification invariants.

Driver Plugin/provider author Lean

against the shipped Datalog, and an axiom audit confirms that the development uses only standard Lean axioms (including classical choice), with no project axioms or admitted proofs. The loader, certificate extraction, provider traversal, module-guard insertion, Soufflé, seed-loop termination, the general (F) reduction and shipped-kind finiteness/fixed-answer arguments are not mechanized. 4.1

Programs, Inputs and One Derivation

Let 𝑃 be the union of the prepared Datalog layers and 𝐼 = (𝐴, 𝑈 , 𝑉 , 𝐸) contain author facts 𝐴, user facts 𝑈 , certified available metadata 𝑉 and probe answers 𝐸; 𝐷 (𝐼 ) = 𝐴 ∪𝑈 ∪𝑉 ∪𝐸. Manifests classify inputs by origin and relations by visibility (§3.3); the loader enforces both and rejects predicate cycles through negation or aggregation. Unique model (standard fact). Stratified 𝑃 with finite stratum evaluations has a unique perfect model 𝑀𝑃 (𝐼 ) [2]. Term construction makes finiteness an obligation. Below 𝑀𝑃 (𝐴, 𝑈 , 𝐸) fixes 𝑉 ; neither 𝑃 nor 𝑉 changes between rounds. A run’s observable outcome comprises its sorted error report, emitted build graph and exit status. Invariant 1 (Toolchain uniqeness). For each required (language, build platform, target platform) key, multiple unpinned candidates, conflicting pins or a non-candidate pin derive an error. Otherwise at most one toolchain is selected; no selection derives “no toolchain” at every target with an action in the configuration. 4.2

Discovery

Here “request” means a probe request, not a target request. Each probe kind 𝑘 declares requests req𝑘 , domains dom𝑘 and results with a primary row, keyed by (𝑘, id (𝑟 )); req collects all kinds’ requests. A guarded read, including negation or aggregation, entails a positive identifier-matching request in the same disjunct; the loader checks a sufficient syntactic condition (W3). Package selection reads 𝑉 ; all shipped environmental kinds are guarded. Writing 𝑅𝑖 for the round-𝑖 probe requests still lacking a primary answer in 𝐸𝑖 , discovery iterates 𝐸 0 = ∅, 𝐸𝑖+1 = 𝐸𝑖 ∪

𝑀𝑖 = 𝑀𝑃 (𝐴, 𝑈 , 𝐸𝑖 ), Ð

(𝑘,𝑟 ) ∈𝑅𝑖 probe𝑘 (𝑟, 𝐸𝑖 ).

It stops when 𝑅𝑛 = ∅. Answers grow, but negation means models need not. The driver checks domain membership, unique argument tuples (W6) and primary-row totality (P1), including negative answers. Obligations are: (P0) probes/fingerprints return; (F) every finite answer set has a finite model; (P2) fixed finite universes U𝑘 contain every round’s domains; and (P3) answers depend only

Meta Build Systems as Logic Programs

13

on arguments, fingerprinted answers, watched filesystem observations and the environment. Fresh means no answers and no cache (--fresh). Theorem 4.1 (Fresh termination). For stratified 𝑃 satisfying (F), (P0) and (P2), a fresh run stops Í or fails a check within 1 + 𝑘 |U𝑘 | rounds: every continuing round answers a new pair. Theorem 4.2 (Fresh determinism). For fixed stratified 𝑃 satisfying (F), (P0), (P2) and (P3), and fixed driver options, the fresh outcome and stopping round depend only on 𝐴, 𝑈 and the environment through the snapshot-dependent answer function 𝛽𝑘 (𝑟, 𝐸). Fact ingestion order and within-round probe execution order do not affect the outcome. This is within-round order independence, not arbitrary rescheduling under (P3). Guarded answers have a least closed set. When a later round withdraws a request, its earlier answer stays stored, but no guarded rule can use it without the request; pruning these inert answers proves leastness without requiring requests to grow monotonically. Condition (A) strengthens (P3) so each request has one answer 𝛼𝑘 (𝑟 ) across runs and rounds: a correct set unions such answers and is closed if it answers every request of its model. We also require that (RL) every result row carry its request identifier, (I) identifiers determine arguments across runs, and 𝛼 be defined on finite universes; (P2) and (CK), passing domain/tuple/primary-row/declaration checks, must hold over every correct-answer subset, not merely reached rounds. Theorem 4.3 (Least closed guarded answers). For fixed stratified 𝑃 guarding every kind and satisfying (F), (A), (RL) and the universe hypotheses above, correct closed sets exist and agree off probe-result relations, giving 𝑀∗ there. The demanded answers 𝐸 ∗ = 𝛼 (req(𝑀∗ )) form the unique least correct closed answer set. Reusing answers. Whole-run replay validates a recorded run, whereas seeding confirms retained answers against current requests and keys from confirmed prerequisites, dropping stale seeds without probing and retrying fresh if a check fails. Cache soundness assumes (FC) that equal keys and unchanged watches determine answers (for shipped compiler probes, unobserved external and toolchain inputs must stay stable until --fresh, §3.8; observation completeness is not checked) and (FL) that keys and probes read only acyclic prerequisite answers demanded by every derivation of the probe request. Corollary 4.4 (Cached and fresh runs agree). Under the determinism and least-closure hypotheses, (FC) and (FL), completed replay, seeded and fresh runs have the same outcome and agree off probe-result relations. Retained inert answers need not agree. Preparation before inference. Proposition 4.5 (Bounded preparation). Given complete finite provider enumeration and fixed, answer/demand-independent links, 𝐿 𝑗+1 = 𝐿 𝑗 ∪ links(𝐿 𝑗 ) from declared roots terminates at the least reachable closure. Composition consumes its valid executable union once; environmental rounds cannot change that union or its metadata. Coverage. The shipped-kind argument establishes (A) from (P3) except for CUDA, where it remains an obligation. The (F) audit covers core, C/C++, Halide and Qt, not arbitrary projects or the Python, Emscripten, NDK and CUDA plugins (§A.2 and §A.4). The supplement also generalizes to unguarded plugins; their fixed answer set is empty here.

14

Alex Reinking

4.3

Consequences of the Stratification

The decision relations are explicit request, request_all and declared kind; they are answer-free when no positive, negative or aggregate path reaches probe results (W5). Because the loader checks only authored clauses whereas module-use guards can add paths (including to packages’ target requests), full-program W5 remains a hypothesis: all 13 audited study/SDK configurations pass (Qt was not included in that audit), while our two-library generating consumer builds even though its dormant-package control fails W5 (§C.6). Proposition 4.6 (Explicit target reqests are answer-free). For fixed stratified 𝑃 satisfying (W5), explicit target requests and their kinds depend only on 𝐴, 𝑈 and fixed metadata 𝑉 , not answers. Error propagation waits for complete ← ¬pending(_). Proposition 4.7 (Errors do not steer discovery). For well-formed 𝑃 ((W1)–(W6), Definition A.6), let 𝑃 ′ remove the error-propagation gate. Under (F) for both and (P0), (P3), their requests, answers and driver checks agree each round; completed models agree on errors and attributions. (W4) protects requests, domains and discovery checks from completion-gated heads. Invariant 2 (Tool configurations). With no setting/tool-configuration error and exactly one fact identifying the build machine’s platform, every configuration 𝑐 has a unique tool(𝑐). A typed tool reference to 𝑔 in an action of 𝑐 derives needed (𝑔, tool(𝑐)). Direct tool-induced edges arise only from such references or built-toolchain tools. 4.4

Built and Imported Artifacts

The export result is conditional and set-level, not a command or binary equivalence claim. An export (𝐹, 𝑅) pairs usage facts 𝐹 with hash-pinned rules 𝑅. buildlog’s native format loses neither, whereas foreign formats classify each own fact exclusively as spelled, lost with a warning or an error, and warn whenever rules 𝑅 are dropped (Lemma A.8). Remark 1 (Set-level downstream use). Given an error-free export with no loss (E1), inverted spelling/relocation (E2), the same resolved components/configurations (E3), unchanged other consumer inputs/dependencies (E4), and rules adding no usage facts about their own targets (E5), downstream use preserves the built target’s supported usage facts as a set, relocated to the install prefix. In buildlog’s format the consumer also receives 𝑅. This remark concerns supported dependency, link and setting facts rather than emitted commands or binaries; order, multiplicity, version acceptance, external absolute paths and hand-written package files are excluded (§A.5). 5

Case Studies

Eleven studies of ten projects port pinned open-source builds, each isolating a capability and comparing with the project’s own build, called upstream (§6.1). Meson and Bazel supply two nonCMake engines; nanobind uses CMake through scikit-build-core. The supplement lists releases and scope (§C.1) and further capabilities, including C++20 modules and CUDA (§C.6). The studies ran on an arm64 Mac with Apple clang; unless another destination is specified, “cross” means arm64-to-x86_64 macOS. The studies also build on arm64 Linux with GCC 13 and Clang 18; scoped execution records are separate (§C.8). 5.1

Halide

Halide [55] is the stress test: an LLVM-based compiler whose generators, runtimes and autoschedulers are rule strata that entail library facts, run during the build.

Meta Build Systems as Logic Programs

15

The full build. buildlog builds libHalide and runs 941 of the 950 tests defined by upstream’s CMake build, including Python bindings, tutorials and autoschedulers: native execution yields 848 passes, 93 skips and no failures across 941 executions. The nine excluded tests either invoke a nested build whose outputs are ordinary targets here, drive a debugger, or check a Windows-only filter (§C.3). Because native tools inherit the Python setting, generators share the product’s libHalide build; release, debug and ASan are declared configurations. The cross build. From arm64 macOS to Linux on AArch64, buildlog builds libHalide, its runtime and a 32-test validation subset (20 correctness and 12 generator/AOT tests), in one tree from one configure, the generators and build-time tools for macOS and the rest for Linux; the tests give 30 passes and 2 skips, as under CMake, whose build takes two trees and two configures. Rules relocate run paths and prefix imported paths with the sysroot. The tests cover mechanisms such as C sources, image I/O, multitarget output and separate runtimes, not a statistical sample. The user pins an otherwise ambiguous build-machine compiler. Specification size. The current port uses 2,642 specification and rule lines against CMake’s 5,361, excluding blank lines, comments and source-only lists. The count includes the Python and tutorial rules as well as reusable generator helpers (§C.2). Cross-built apps. Upstream builds Halide’s HelloWasm and HelloAndroid apps with a super-build and a nested configure; in buildlog each is one configure and one graph. Generator runs are identical to CMake’s (15 and 4), all four WebAssembly variants run 64 frames under Node.js with identical final frames, and the Android libraries export all eight JNI entry points (not run). Two plugins stand in for Emscripten’s and the NDK’s toolchain files (§C.4). 5.2

Build-Time Tools: flatbuffers and fribidi

flatbuffers in CMake and Bazel. flatbuffers’ flatc compiles schemas into C++ headers during the build, so in a cross build it must run on the build machine. A CMake cross build requires two build trees and a hand-spelled tool path (google/flatbuffers#5525), and silently runs a stale build-machine binary whenever flatc’s sources change. buildlog’s project uses flatc as the program an action runs, and nothing else says where it runs. Natively every compile pairs with CMake’s (Table S9). With --config x86_64 (140 commands), flatc is built once for arm64 and run 11 times, the generated headers are byte-identical to CMake’s, and the x86_64 tests pass under Rosetta. A universal2 configuration (210 commands) builds fat products and both slices’ tests pass. In a slice of flatbuffers’ Bazel 8.8.1 cross build, every buildlog action matches by configuration role, type and unit; the generated header is byte-identical. Bazel’s genrule names flatc twice, once in tools with its exec transition; buildlog names it once. Misplacing flatc among Bazel’s product-configured sources silently builds and runs an x86_64 tool under Rosetta; the corresponding buildlog mistake fails with both machines named. fribidi and Meson’s native flag. fribidi 1.0.17 generates its Unicode tables with seven programs that must run on the build machine. Meson asks the author to write native: true on each and, separately, to ask for the build machine’s compiler for their header checks; fribidi’s ask the cross compiler, right here only because both platforms share one SDK. In buildlog no row marks a build-machine tool, and a check is answered in the configuration of the target that uses it. Crosscompiled for x86_64 from a user file, buildlog builds the seven programs once for arm64 and splits the 42 objects as Meson does.

16

5.3

Alex Reinking

Further Studies

Checks and exports. zlib 1.3.2’s five checks agree with CMake’s cache and its zconf.h is byteidentical, without CMake’s generator-expression bug (§C.5). nlohmann/json 3.12.0’s downstream usage facts agree in-tree, through CPS and through CMake exports from either system, also after relocation. Installed headers/package files agree; pkg-config’s lost language standard is reported. ISA variants. zlib-ng 2.3.3’s universal2 CMake build silently omits SIMD in both slices (zlibng#1016). buildlog derives per-source ISA flags for both slices in one configure, matching separate single-architecture CMake builds (§C.5). ggml’s run-time CPU modules instantiate one template per ISA level (§§3.2 and 3.6); module sets, flags and symbols match CMake’s. On ARM, upstream accepts -march=native tuning with all variants but emits modules without the scoring entry point ggml’s backend loader requires, so it selects none. buildlog rejects that combination. Imported data and interpreter configurations. SPIRV-Tools’ six generated files from imported SPIRV-Headers grammars are byte-identical to CMake’s; why traces their inputs to the user’s prefix. nanobind makes the Python interpreter a configuration setting and derives the stable ABI, definition, file name and wheel tags together. Symbols and wheel metadata match scikit-build-core/CMake across both tested Python interpreters (3.11 and 3.13). Qt: rules a library ships. A Qt 6.11.3 consumer uses the rules of §3.5, never naming moc. Its 15-line specification compares with CMake’s 13; both tests pass on macOS and Linux. This compares consumer specifications, not coverage of CMake’s Qt implementation: the package handles listed headers and resources, not uic, Q_OBJECT in .cpp files or compiler-predefine generation. why traces a generated source to the QtCore dependency. Further capabilities. TinyCC bootstraps three compiler stages in one graph: a compiler built by one stage serves as the next stage’s compiler, linker and archiver. Stages two and three are byteidentical. C++20 named modules exercise build-time dependency discovery, as Fortran modules do: source scans feed a rule stratum that derives Ninja dyndep files and shared or specialized module interfaces. A fmt module consumer builds and runs without naming its module in the specification. CUDA and stdgpu compile and link with a real toolkit. These are capability checks beyond the eleven portfolio studies (§C.6); no NVIDIA GPU was available for CUDA execution. 6

Evaluation

We assess whether buildlog produces correct builds in practical configuration times, not superiority to mature systems. Execution checks and command comparisons remain separate evidence, while provenance queries and pin ablations evaluate explainability and user control (§C). 6.1

Method

We tokenize actions with machine paths as placeholders, attributed through CMake’s File API, meson introspect or bazel aquery. Pairs match unit (target/source for compiles, output for libHalide), action type and configuration role, checking tool versus product configuration on both sides (§C.3). Output checks cover file hashes, symbols, archives, load commands, installed trees and tests, as applicable. Artifact scripts configure buildlog against recorded upstream baselines at matching pinned revisions. The full native Halide graph comparison and execution checks cover the current port; execution results are reported separately from command comparisons. Native fidelity records and configure API measurements use an Apple M3 Max (16 cores, 48 GiB), macOS 26.5.2, Xcode 26.6 (Apple clang 21.0.0), CMake 4.4.3, Meson 1.12.1, Ninja 1.13.2, and Soufflé at a fixed revision with the artifact’s local changes (§3.8). Configure API measurements use

Meta Build Systems as Logic Programs

17

Table 2. Build validation for the ported configurations. Halide counts are executions (941 distinct macOS tests); exclusions and Linux failure controls appear in the text.

Study

Tests and artifact checks

zlib / zlib-ng Variants: 2/2 and 7/7 tests pass; symbols, headers and packages checked flatbuffers CMake port: 1/1 test passes; Bazel slice generates the same header and runs it fribidi Native library/tools: 9/9 tests pass; generated tables and symbols checked ggml Selected CPU variants pass; loader selects the predicted backend SPIRV-Tools Ported library/tools: 4/4 tests pass; six generated files identical nlohmann/json Installed headers identical; in-tree and installed consumers build nanobind Python 3.13 and 3.11 tests pass; ABI modes and wheel contents checked Qt consumer 2/2 tests pass; corresponding CMake consumer builds with moc/rcc libHalide macOS: 848 pass, 93 skip, 0 fail; Linux (877 tests): 783 pass, 92 skip, 2 fail

Python 3.14.0 and serial runs at a one-minute load of 3.4–5.3; the separate portfolio CLI comparison also uses Python 3.14.0, with its own recorded load. Their whole-process CLI and in-process API timing boundaries are distinguished in §6.4. 6.2

Fidelity

We first check whether the configured graphs build usable artifacts and pass the scoped tests (Table 2). We then compare commands to locate differences that those tests may miss. Neither passing tests nor matching normalized commands proves full build equivalence, equal runtime performance or equal code size. Command differences. The detailed pairing table and taxonomy are in §C.3. Spelling normalization removes compiler paths and equivalent platform spellings, not optimization or visibility flags. Rebuilding with baseline flags changes no zlib or fribidi output; flatbuffers’ C++11 versus CMake’s C++14 changes 3 of 85 objects. These experiments support only the pairs rebuilt, not a general claim that flag differences are harmless. Bazel applies a different optimization and hardening policy, not replicated by the slice. Of 4,748 Halide pairs, 2,814 differ at most in spelling, 538 only in warnings/includes, and 1,396 carry potentially consequential differences (PCH, wrappers, export/LTO, custom commands and links; §C.3). Current-graph replay gives identical objects for 438/438 wrappers and 728/730 PCH compiles; two runtime-buffer tests gain code with PCH. Four tutorial regressions check Release optimization, normal visibility and C++17. End-to-end runtime performance and the code-size effects of remaining flag differences are not measured. Unpaired work includes fixtures, staging and exports CMake writes during configuration; counts alone do not measure missing functionality (§C.3). Scope and failures. The full Linux GCC Halide run gives 783 passes, 92 skips and two failures; a focused rerun passes one and reproduces the other’s speed assertion against both the buildlog build and the independent CMake-built library. We do not count these as all tests passing (§C.8). The Linux scope excludes Python bindings. Normalization. Except libHalide’s, the comparisons treat flags as sets and sort link inputs. An order-keeping comparison of the other studies finds only independent flag groups interleaved, with no potentially consequential order differences (§C.3).

18

Alex Reinking

Pins. Removing pins one at a time from the user files of TinyCC and every study but Qt’s, one of 43 rows is necessary with Apple clang alone, versus 36 when Homebrew’s LLVM is also offered. On Linux with GCC and Clang, 21 of 34 are necessary. A user-global file with one row per toolchain role (C, C++ and the linker driver) replaces the repeated toolchain choices; Halide’s separate LLVM-linkage pin remains. Thus machine-wide toolchain policy can be stated once in a user file rather than per project (§C.9). Specification size. Excluding shared infrastructure but charging project-specific rules, ggml uses 501 lines against CMake’s 644 and zlib-ng 523 against 1,223. SPIRV-Tools’ port is also shorter; fribidi’s is longer (301 against Meson’s 263), largely for config.h. §5.1 gives Halide’s count, and §C.2 details the counting rules and per-study breakdown. 6.3

Provenance Answers

For app, util’s public C++20 requirement dominates its dependency core’s C++17. This excerpt traces the winning value: action_arg("<object>", 10, "-std=c++", "20") [cpp:L4_cxx.dl:33] ... use_join("app", <x86>, "cxx.std", "20") [L1:760] use_cand("app", <x86>, "cxx.std", "20", 1) [L1:742] eff_dep("app", <x86>, "util", "private") [L1:596] ... eff_prop("util", <x86>, "cxx.std", "20", "public") [L1:718] (via iface) ... prop("util", "cxx.std", "20", "public") ← cross/spec.toml:70 lattice_key("cxx.std") [L1:748]

Here <object> abbreviates the object path and L1 is L1_targets.dl. The answer shows the winning C++20 requirement, not the losing C++17 candidate; negation and joins are checked against the model (§C.12). why-not explains blocking premises using overridable witnesses. For a complete generator explanation, see §C.7. 6.4

Configure Cost

End-to-end comparison. Ten serial CLI trials alternate tool order with private sources, builds and caches (Table 3). Timing includes startup, probes and graph generation, not builds/tests. Cold empties tool state, not filesystem caches; warm invokes configure unchanged; edit adds a corresponding private definition. zlib is shared-only; Halide includes Python, tutorials and tests on both sides. Port omissions remain: CMake includes extra ggml tests/examples, but its SPIRV-Tools tree lacks the GoogleTest checkout and omits tests. Nanobind’s upstream time sums two direct CMake configures, one per interpreter. §C.10 details scopes and SDK-app costs, whose upstream outer configures do different work. Cold configuration completes in seconds, though fixed startup overhead remains noticeable on small projects, demonstrating practical feasibility rather than uniform speed parity with CMake. One composition. In-process API instrumentation shows one composition and evaluator start cold or after an edit, with four evaluations cold and one after edit; unchanged runs only validate certificates, where repeated scans dominate warm Halide (§C.11). Cached against fresh. Tests compare seeded/fresh facts and graphs after configuration, answer, dependency, pin, prefix and metadata changes, checking probe order, invalidation, fallback and zeroevaluation reuse (§A.2). They complement, not discharge, probe-author obligations (Corollary 4.4).

Meta Build Systems as Logic Programs

19

Table 3. Whole-process configure seconds, buildlog / upstream, each a mean±relative 95% confidence half-width from ten trials. Upstream is CMake except fribidi (Meson) and the Bazel slice. † Ported test and example scope differs from upstream; see text.

Project zlib nlohmann/json zlib-ng ggml† fribidi flatbuffers SPIRV-Tools† nanobind Halide Bazel slice Qt consumer

6.5

Cold

Warm

Edit

2.47±4.8% / 1.43±8.7% 2.03±4.4% / 0.33±7.2% 3.49±4.0% / 4.56±6.5% 4.30±4.1% / 3.73±4.6% 2.60±2.8% / 1.41±8.0% 2.35±4.1% / 0.71±7.2% 2.36±2.9% / 0.86±5.3% 2.51±4.2% / 0.96±7.0% 6.74±2.3% / 6.12±2.7% 2.17±2.9% / 6.22±6.3% 2.61±1.6% / 0.79±1.5%

0.14±5.9% / 0.11±9.6% 0.12±3.1% / 0.10±7.9% 0.15±6.7% / 0.29±6.1% 0.19±5.7% / 0.42±6.6% 0.14±4.6% / 0.36±4.8% 0.14±10.8% / 0.12±8.2% 0.14±6.4% / 0.37±7.0% 0.13±9.8% / 0.25±8.6% 0.43±5.2% / 2.97±3.3% 0.13±8.6% / 0.19±3.3% 0.24±2.3% / 0.18±1.8%

0.87±9.4% / 0.11±13.6% 0.70±5.0% / 0.10±10.8% 0.97±17.2% / 0.29±11.7% 1.08±1.6% / 0.42±6.8% 0.87±2.7% / 0.36±6.1% 0.83±2.6% / 0.12±12.2% 0.97±2.3% / 0.37±7.6% 0.81±3.0% / 0.23±5.6% 4.08±3.5% / 2.91±3.1% 0.78±1.9% / 0.14±3.9% 1.13±4.0% / 0.18±2.4%

Threats to Validity

Feature-selected projects validate mechanisms, not typical-build coverage. C/C++ run checks expose only build-machine exit status, not printed values, compiler output matching or chained answers; general probe kinds admit acyclic prerequisites (§4.2). Source content cannot select files: moc runs on every listed header. Normalization affects fidelity; functional checks do not establish equal performance or code size. Timings use one machine, warm filesystem caches and stated port omissions, not representative workloads. Finally, no user study evaluates authoring specifications, diagnosing errors or reading provenance explanations. 7

Related Work

Build systems. Mokhov et al. [47, 48] model Make, Shake [45], Bazel and others as a scheduler and a rebuilder; Pluto [13], Rattle [57, 58] and CloudBuild [14] prove dynamic dependencies sound, trace them, and distribute builds. They execute graphs; buildlog derives them. Pants. Pants v2’s typed @rules form a static rule graph, reject ambiguous inputs and memoize results [53], close to a Horn program over types. Rules are Python coroutines, however, without proof explanations; Pants 2.33’s C/C++ backend has no library targets [52]. Bazel and Buck2. Bazel’s Skyframe [66] and Buck2’s DICE [69] memoize host-language computations, and Bazel selects compatible toolchains by registration priority where buildlog requires uniqueness. Like Shake’s oracles [46] and Bazel’s repository rules and module extensions [64, 65], buildlog separates impure answers from pure evaluation, while also deriving the probe requests as facts. Where Bazel and Buck2 declare configuration transitions [63, 68] and aquery lists configured commands [61], buildlog infers tool configurations (§5.2) and explains flags by proofs. qbs. qbs’s Probe items cache imperative script results in properties [81], whereas buildlog’s probes have rule-derived requests, finite domains, cache keys and provenance. Like buildlog, qbs activates moc when a product depends on Qt.core [80, 83], but through scripted module items rather than library-supplied Datalog rules composed into a single checked stratified program.

20

Alex Reinking

Gradle. Gradle’s configuration cache reuses graphs while observed inputs match [21]; buildlog also caches individual probe answers. Gradle’s lazy properties derive edges from producing tasks’ output-to-input wiring [22], like buildlog’s typed placeholders but without proof explanations. Packages and configuration. Version resolution is NP-complete [39]; solvers use SAT, ASP or optimization [1, 54]. Spack [17] resolves choices with answer-set programming [16, 18] and could supply them to buildlog. Deriving a graph from fixed choices needs a unique model, not optimization. Nix and Guix [9, 11] derive package-level steps; Nix can evaluate purely [78] or wait on builds [79], whereas buildlog confines effects after preparation to between-round probes. Datalog and provenance. buildlog uses Soufflé and stratified negation’s unique perfect model [2], as in Datalog program analysis [4, 6, 85]. Its rules also derive which environmental facts to collect. buildlog encodes lattices with ranks and aggregates; Flix [38] and Datafun [3] support them natively. Probes resemble HEX external atoms [7, 12], but are answered between rounds. Provenance semirings [23], why-not provenance [8], PUG [36] and Soufflé’s proof reconstruction [86] explain queries. buildlog uses the latter to trace flags to specification, user, package and probe-request leaves, separating proofs from demand (cf. magic sets [5]). Studies and analyses of build code. Build maintenance is costly [41–43]; prior work migrates, analyzes and traces build scripts [20, 37, 60], and translates CMake to formulae [51], traces affected commands [49] and types scripts [25]. None derives the configured graph as a logic program’s model, nor does Biomake [26], a Make-compatible executor whose Prolog rules are order-dependent. 8

Conclusion

Expressing configuration as relational inference makes a build’s command graph the model of an explicit logic program rather than the side effect of imperative scripts. In buildlog, plugins answer only the probe requests derived by that program, while stratified rules compute a unique model that rejects ambiguous toolchain or package candidates and gives every derived fact a provenance proof. Authors state constraints and users state preferences through distinct, statically checked input relations; libraries ship domain-specific consumer rules using the same facts for installed and built code; and running a compiled tool in a build step entails its build-machine configuration. Across eleven case studies of ten projects, buildlog configures C and C++ builds in practical times while reporting remaining command differences, and derives Halide’s build-machine generators and target-platform products in one graph rather than nested build trees. Limitations and future work. A build currently admits one rule-package version per library, and edits re-evaluate the full Datalog program (§6.4). Future work pairs incremental Datalog evaluation [59] with Windows/MSVC support, additional plugins, and a Python ABI lattice with wheel exports—extending a small, explainable model in which build configuration follows by logical entailment from discovered environmental facts. AI Use The authors used generative AI throughout this work, under their direction and with their review. Implementation: buildlog, its tests and the case-study specifications were written in tight collaboration with AI coding agents (GitHub Copilot CLI driving Claude and GPT models); the authors designed the system, specified each change, and reviewed and verified every change against the full test suite before merging. Proofs: the Lean development was written with AI assistance; Lean’s kernel checks every proof. Evaluation: AI agents performed reproduction runs and baseline comparisons that the authors checked. The authors take full responsibility for all content.

Meta Build Systems as Logic Programs

21

Data-Availability Statement buildlog, its test suite, and the case-study baselines and deviation tables will be made available as an artifact. The upstream sources of the case studies are pinned git submodules of the artifact’s repository. Prerequisites that are built or installed separately (the patched Soufflé, a Halide install, SPIRV-Headers, Qt, Python environments) are located by environment variables, listed in an example file, and the tests that need an unset one are skipped. The artifact will be archived with a DOI for the Available badge, with the hardware and software needed to reproduce the case studies.

22

Alex Reinking

Table S1. Notation of §4 and the relations of the submitted core that realize it. Concept

Relation(s)

needed closure: target 𝑡 is built in config. 𝑐 tool configuration tool(𝑐) decision relations effective option value (user value, else author default) probe kind 𝑘: req𝑘 , dom𝑘 , results pending, complete toolchain selection; export spelling and loss

needed(𝑡, 𝑐) exec_config(𝑐, 𝑒) request, request_all, native_kind option_effective req_𝑘, domain_𝑘, res_𝑘. . . , declared in a layer manifest probe_pending, discovery_complete tc_select; export_spelled, export_lossy

Supplementary Material A

Proofs and Details for the Formalization

This section gives the proofs of the results stated in §4, the full cache-reuse algorithm with its guarantee, the finite-construction audit, and the export conditions with the complete table of round trips. Unless stated here, the statements, definitions and hypotheses are those of the paper; we refer to them by their numbers there. The export lemma and downstream-use remark, summarized in §4.4, are stated in §A.5. Table S1 maps the notation to relations, Table S3 maps guarantees to conditions in full, and Table S4 defines each condition, grouped by role, with its discharge. The guarantee-indexed summary, with the assurance boundary, is Table 1; Table S2 gives each result’s conditions and Lean status. Definition A.1 (Terms). Values are symbols, numbers and constructed terms: a setting ⟨𝑘, 𝑣⟩; a configuration ⟨𝑝, 𝑠⟩ of a platform 𝑝 and a finite list 𝑠 of settings, sorted by key; and a condition, built from eq(𝑘, 𝑣), defined(𝑡) and named(𝑛) with ¬, ∧ and ∨. Symbols may also be built by concatenation. The general condition evaluator reads effective settings, target-name existence for defined(𝑡) and the condition expression declared under 𝑛 for named(𝑛). Request and kind conditions instead admit only option tests (§A.3). A.1

One Derivation and Discovery

General schedule. The main paper specializes to shipped guarded kinds. For the generic plugin interface, let 𝐺 be the guarded kinds and let 𝑄𝑖 be all requests of 𝑀𝑖 lacking a primary answer in 𝐸𝑖 . The driver selects ( {(𝑘, 𝑟 ) ∈ 𝑄𝑖 | 𝑘 ∈ 𝐺 }, if this set is nonempty, 𝑅𝑖 = 𝑄𝑖 , otherwise. Thus 𝑅𝑖 = 𝑄𝑖 when all kinds are guarded; the general loop stops when 𝑄𝑖 = ∅. The finite-progress and round-induction proofs below apply to either schedule. Rule inspection for Invariant 1 (toolchain uniqueness). Here a layer requires ℓ in 𝑐 (tc_required), so (ℓ, 𝑒, 𝑝) is used (tc_used). Without a pin every candidate is selected; with one, only the pinned candidate is. An error naming (ℓ, 𝑒, 𝑝) is derived if two candidates are selected, if two pins disagree, or if a pin names a non-candidate. The cases are exhaustive. If no toolchain is selected, has_tc(ℓ, 𝑐) fails, and the rule for “no toolchain” derives the error at every target with an action in 𝑐. The error rules use only negation of lower-stratum relations. These are rule-level invariants of the submitted

Meta Build Systems as Logic Programs

23

Table S2. The guarantees of §4 by condition: the conditions each adds to those of the rows it cites, and their discharge: L loader check, D driver check, S argument for the shipped rules and probe kinds, O plugin-author obligation. Checks cover reached rounds only. Lean: A abstract engine model, T transcription of the shipped core rules (drift-checked). Conditions are defined in Table S4. Guarantee

Needs

Discharged by

Lean

Termination (Thm. 4.1)

(W1), (F), (P0), (P2)

(W1) L; (F) S/O; (P0) O; (P2) D membership, S/O finiteness O

A

+ (P3) Order independence of a fresh run (Thm. 4.2) Least closed guarded answers + (W3), (RL), (A), (I), (CK) (Thm. 4.3) + (FC), (FL); guarded-first Cache agreement (Cor. 4.4) schedule Bounded preparation (Prop. 4.5) Answer-free target requests (Prop. 4.6) Errors do not steer (Prop. 4.7) Toolchain uniqueness (Inv. 1) Tool configurations (Inv. 2) Export fidelity (Rem. 1)

finite complete provider graph; fixed links (W1), (W5) (W1)–(W6), (F), (P0), (P3) shipped core rules + one build-machine platform fact; no setting or toolconfiguration error error-free export; (E1)–(E5)

A; fresh = --fresh

(W3) L; (RL) O; (A), (I), (CK) S/O; (CK) D on reached rounds (FC) O; (FL) S/O; schedule and fallbacks D

A; (A)’s shipped argument not mechanized A, given confirmation certificates; seed loop not mechanized enumeration O; code checks and observations A: finite graph only D L on authored clauses; full guarded depenA, given dependency dency certificate O certificates L; (W6) and domains D A, (W4) gate discharged S T S; errors reported T, functional form (E1) S in buildlog’s format, else O; (E2), (E3) T: exclusive classification, O, fixture-tested; (E4) S in part; (E5) O (E1) premise

core, not properties of arbitrary extensions. The selection and rejection rules in L2_toolchains.dl, abbreviating diagnostic strings and the two pin-conflict diagnostics, are: tc_select(l,e,p,t) :- tc_candidate(l,e,p,t), !pinned(l,e,p). tc_select(l,e,p,t) :- tc_candidate(l,e,p,t), toolchain_pin(l,e,p,t). error("ambiguous",...) :- tc_used(l,e,p), tc_select(l,e,p,a), tc_select(l,e,p,b), a < b. error("non-candidate pin",...) :- tc_used(l,e,p), toolchain_pin(l,e,p,t), !tc_candidate(l,e,p,t). error("conflicting pins",...) :- toolchain_pin(l,e,p,a), toolchain_pin(l,e,p,b), a < b. error_at("no toolchain",...,t,c) :- tc_required(l,c), !has_tc(l,c), cfg_name(c,n), target_action(t,c,_). Here pinned(l,e,p) :- toolchain_pin(l,e,p,_). The missing-selection diagnostic uses !has_tc(l,c), where has_tc(l,c) :- tc_for(l,c,_). Both invariants are mechanized in Lean against a transcription of the shipped rules, kept in step with the sources by a drift test (§4); the inspection above and the property tests below are secondary evidence. Property-based tests in tests/test_core_invariants_prop.py check ambiguity, pin conflicts, invalid pins and no silent choice, as well as the two directions of the tool-induced configuration invariant below. They generate small projects from a fixed seed (20261012): 130 for toolchain selection and 110 for the tool configuration, compared with an independent least fixpoint, plus a check that the generator covers pins, zero to three toolchains and a tool also used as a library. All 241 cases pass. Lemma A.2 (Finite rounds). If 𝑃 is stratified and satisfies (F), and every probe call returns (P0), every round reached has a finite 𝐸𝑖 and a finite, unique 𝑀𝑖 .

24

Alex Reinking

Table S3. Full guarantee conditions and discharge; cited results’ hypotheses also apply. Shipped rules: core, C/C++, Halide and Qt. Shipped probe kinds: core and production/case-study plugins, excluding fixtures. Guarantee

Conditions

Checked, or obligation

A unique model (§4.1)

𝑃 stratified; its model on 𝐷 (𝐼 ) finite

No silent toolchain choice for a needed target (Invariant 1)

as §4.1; the core’s selection and error rules

Discovery stops, with nothing pending or Í at a failed check, within 1 + 𝑘 | U𝑘 | rounds (Thm. 4.1)

𝑃 stratified; (F); (P0) and (P2) for every probe kind

The outcome, and which check fails, depend only on 𝐴, 𝑈 and the environment, not on order (Thm. 4.2) Guarded answers have a unique least correct closed set; all correct closed sets give 𝑀𝐹 (generalization of Thm. 4.3) A replay and a seeded configure have a fresh configure’s outcome (Cor. 4.4)

as Thm. 4.1; (P3) for every probe kind; a fixed prepared program and available metadata

Stratification of the composed program checked by the loader. Finiteness an obligation, argued only for the shipped rules (Lemma A.7). Not a loader check: the core’s rules derive an error for an open or inconsistent choice, and “no toolchain” when none is selected. The driver checks domain membership, argument tuples and missing primary answers in each round, so (P1) is a check, not a hypothesis. (P0) an obligation: the driver sets no time limit. (F) an obligation, argued for the shipped rules (Lemma A.7). Finiteness of each U𝑘 , which may depend on the environment, an obligation. (P3) an obligation. The driver reports all of a round’s check failures in canonical order; implemented and tested under shuffled probe orders. Shuffle tests also compare emitted graphs. (W3) checked by the loader. The universal requestdomain and answer hypotheses are obligations. (A) proved for the shipped kinds from (P3) (Lemma A.3).

fixed stratified 𝑃 ; (RL), (F), (A), (I); finite request universes; (P2), (CK) over every correct-answer subset; correct unguarded 𝐹 as Thm. 4.2 and Thm. 4.3, including (RL); (FC), (FL)

Preparation reaches the least include/rule closure (Prop. 4.5)

finite complete enumeration; fixed links independent of answers and demand

Requested targets and their declared kinds are decided before discovery (Prop. 4.6) Errors do not steer discovery (Prop. 4.7)

fixed 𝑃 , 𝐴, 𝑈 , 𝑉 ; 𝑃 stratified; (W5)

𝑃 well-formed: (W1)–(W6), including (W2)’s finite domains and (W3) for kinds seeded beyond replay; (F) for 𝑃 and 𝑃 ′ ; (P0), (P3)

A target an action runs is no setting or tool-configuration error; needed in its unique tool config- one fact identifying the build machine’s uration (Invariant 2) platform

For an exported configuration, each own fact is spelled, lost with a warning, or an export error, exclusively on errorfree models; each requirement is stated or an error; foreign formats warn that shipped rules are lost (Lemma A.8) Depending on an exported target gives the built target’s relocated usage facts, as a set (Remark 2)

Every fact in 𝑀𝑛 has a proof tree (§4.4)

the model exists; an active export format

an error-free export; (E1)–(E5), for the component and its requirements. Excludes order and multiplicity, version acceptance, absolute paths outside the package, and hand-written packages with no built counterpart the final model exists and is finite

The driver answers nothing in a round that drops a stale seed, reruns seeded when a replay deviates, and reruns unseeded when a seeded run fails a check. (FC), (FL), (I) obligations; the shipped request rules preserve domain membership, and shipped identifiers are injective by construction (§A.2). Enumeration is a provider obligation. The driver validates the executable union before inference and confirms observations; no environmental round admits code. W5 checked on authored clauses; full guarded W5 is an additional obligation. Stratification checked on the guarded union. (W1), (W3), (W4) checked by the loader; W5 has the qualification above. (W4) protects request, domain and discovery-time check relations from completion-gated rule heads. (W6) and domain membership checked by the driver in each round. Finiteness of the domains across rounds, in (W2), an obligation. By the core’s rules, which derive the tool configuration and the need; an action that runs something unrunnable derives an error. Mechanized against the transcribed rules (base_exec_exists_unique); “the model exists” alone does not give a total tool (𝑐 ) . By the export layer’s rules. Tests cover examples of loss and warning, not every exporter case.

(E1) by construction only in buildlog’s format; the other formats report losses. (E2) and (E3) tested on fixtures, not proved. Ownership partly discharges (E4) for shipped rules, except their actions. (E5) an unchecked assumption on shipped rule layers. Soufflé’s provenance; why prints it. Negated premises, constraints and aggregate results are leaves. An installed fact’s proof stops at its installed facts file, not at its producer’s derivation.

Meta Build Systems as Logic Programs

25

Table S4. Conditions by role and their discharge: L loader check, D driver check, S shipped-kind/rule argument, O plugin-author obligation. Checks cover reached rounds only; S has the audit boundaries of §§A.2 and A.4. Condition Probe obligations (P0) Return (P3) Functional (RL) Row ownership (FC) Sufficient keys (FL) Prerequisites

Meaning

Discharged by; where

Probe and fingerprint calls return; no driver timeout. O; §4.2 Answers depend only on arguments, fingerprinted answers, watches O; §4.2 and environment. All answer rows carry their request’s identifier. O; §A.2

Equal keys and unchanged watches imply equal answers across configures. Probes/keys read only acyclic prerequisite answers used by every request derivation. Rule and domain conditions Every finite answer set has a finite model. (F) Finite evaluation (P2), (W2) Domains lie in fixed finite request universes; requests lie in domains. (A) Fixed answers Each request has one answer across runs and rounds in an environment. An identifier determines its arguments across configures. (I) Stable identifiers (CK) Passing Domain, tuple, primary-row and declaration checks pass over every checks correct-answer subset. Preparation Providers enumerate a finite complete graph within declared roots. finiteness Metadata includes and rule pointers do not depend on demand or Fixed links probe answers. Loader and driver checks (P1) Totality Every answer has a matching primary row, even if negative. (W1) Stratified No negative/aggregate cycle, including generated pending rules. (W3) Guarded Each result read entails its matching positive request. (W4) Error isolaRequests, domains and discovery checks cannot depend on tion completion-gated heads. (W5) Answer-free Explicit target requests and declared kinds cannot depend on answers. (W6) Unique One argument tuple per kind/identifier in a round. tuples Export conditions (for an error-free export) (E1) No loss No export loss fact for the component or its requirements. (E2) Inversion Import spelling inverts export spelling, with relocated paths. (E3) Resolution Requirements resolve to the same components/configurations. (E4) Isolation Consumer inputs and other dependencies remain unchanged. (E5) Neutral rules Exported rules add no usage facts about their package’s targets.

O; §A.2 S inventory argument/O; Lemma A.3 S/O; §A.4 D membership; S/O finiteness, §A.2 S from (P3), Lemma A.3; otherwise O S length-prefixing; O, §A.2 S/O; D checks reached rounds only, §A.2 O; Prop. 4.5 Provider contract; D bounded-decoding and observation checks, Prop. 4.5 D at each call; §A.1 L at composition; §4.1 L syntactic sufficient check; §A.2 L dependency check; §A.3 L on authored clauses; O for full guarded union; §4.3 D each round; §A.1 S native format; O otherwise, §A.5 O, fixture-tested; Table S5 O, fixture-tested; Table S5 S ownership in part/O; §A.5 O; §A.5

Proof. By induction on 𝑖. 𝐸 0 is empty. If 𝐸𝑖 is finite, then by (F) 𝑀𝑖 is finite, and the standard model fact (§4.1) makes it unique, so 𝑅𝑖 is finite. By (P0) each of the round’s probe calls returns, and a returned answer is a finite set of rows, so 𝐸𝑖+1 is finite. □ Proof of Theorem 4.1 (fresh termination). By Lemma A.2, each round’s evaluation and probe calls terminate. Let Ans𝑖 be the set of pairs (𝑘, id) with a primary result in 𝐸𝑖 . It grows with 𝑖. In a round with 𝑅𝑖 ≠ ∅, either a check fails (a request outside its domain, two argument tuples for one pair, an empty primary answer) and configure stops, or every request in 𝑅𝑖 gains a primary result, so Ans𝑖+1 ⊋ Ans𝑖 . The per-round domain check places every pair keyed by 𝑅𝑖 in {(𝑘, id (𝑟 )) | 𝑟 ∈ dom𝑘 (𝑀𝑖 )}, and (P2), whose across-round part is not checked, places that in the finite set {(𝑘, id (𝑟 )) | 𝑟 ∈ U𝑘 }. U𝑘 may depend on the environment, as cxx_std’s does through the inventory’s answers, but the environment does not change during configure, so U𝑘 is one fixed set Í for the run. A strictly increasing chain of subsets of a finite set has at most 𝑘 |U𝑘 | strict steps. □ Proof of Theorem 4.2 (fresh determinism). By Theorem 4.1, there is a last round 𝑛. By induction on 𝑖 ≤ 𝑛, 𝐸𝑖 is a function of (𝐴, 𝑈 ) and the environment’s snapshot observations 𝛽𝑘 (𝑟, 𝐸𝑖 ): 𝑀𝑖 is

26

Alex Reinking

unique by Lemma A.2, so 𝑅𝑖 and the checks of round 𝑖, which read only 𝑀𝑖 and 𝐸𝑖 , are determined; every probe of the round reads 𝐸𝑖 and no other probe’s answer of the same round, so by (P3) each answer is determined, and the union defining 𝐸𝑖+1 does not depend on the order in which they are computed. Hence the round at which configure stops is determined. If a check fails in that round, the set of violations reads only 𝑀𝑖 , 𝐸𝑖 and the round’s answers, so it is determined too, and the driver reports all of them in a canonical order (below), so the report does not depend on the order of probes. On success or failure in the model, the outcome reads only 𝑀𝑛 : emit depends only on the model as a set, and the errors are the extension of the error relations in 𝑀𝑛 . □ The driver checks a round in two steps. It first checks every request against its domain and for a second argument tuple. If either check fails, it reports every such violation of the round and runs no probe. Otherwise it runs every probe of the round, collects every empty answer and every undeclared result relation, and, if there is any, reports them all. In both steps the report lists the violations sorted by check, probe kind and request arguments, so it is the same for every order of probes. A test runs a round in which two probes leave three requests without an answer and a third returns an undeclared relation, under reversed and shuffled probe orders, and checks that all four violations are reported, in the same order. The determinism observation is also tested: the driver can shuffle the input facts and the order of probes in each round with a seed, and the integration tests configure the cross-compilation example and the Halide case study under shuffles and compare the emitted graphs. Within a round, every probe reads a read-only snapshot of the answers confirmed at the start of the round, which is 𝐸𝑖 in the definition above, so no probe can observe the order in which the others ran. The driver’s tests check that reversed and shuffled probe orders give the same result. A.2

The Order of Discovery and Reusing Answers

A withdrawing request. Consider an illustrative guarded layer over cc_check, abbreviating two fixed argument tuples and their identifiers by a, b, and its request/result relations by req, res. Assume the prerequisite inventory is already fixed: dom("a"). dom("b"). req("a") :- dom("a"). req("b") :- dom("b"), req("a"), !res("a","yes"). use(X) :- req(X), res(X,"yes").

With no answers, both requests hold. Suppose both checks answer “yes” in that round. The next model withdraws req("b") and derives only use("a"); b’s retained answer is inert. With unchanged program, non-answer input, keys and watches, replay starts with both cached answers, confirms b from the record’s withdrawn list and confirms a from its request, calling neither check. If replay is unavailable, guarded seeding leaves b unconfirmed and prunes it. Both have the fresh outcome, although guarded seeding need not retain the fresh run’s probe-result facts. A configure may start from the previous configure’s answers instead of from 𝐸 0 = ∅. We state what the driver does and then what it guarantees. A probe kind may declare a fingerprint, a function of the request’s arguments and of the answers given so far; the answer’s key is the kind, the arguments and the fingerprint. Answers are cached under their keys. A probe may also record a watch set of filesystem observations; the answer is reused only while those observations remain unchanged. Shipped compile checks watch depfile-recorded files, compiler-reported header/framework search roots and linker search paths, and selected library files. File identities record resolved path, size, modification time, inode and device, not content hashes; directory identities omit size and are nonrecursive. A recorded missing path is invalidated by its appearance. These observations do

Meta Build Systems as Logic Programs

27

not establish complete negative or transitive lookup coverage: a nested earlier candidate, an unrecorded __has_include input, or dependencies omitted by a failed compilation may change without invalidating the retained answer. The shipped probes therefore assume that inputs outside their keys and recorded watches remain stable while an answer is reused. After installing, removing, replacing or restructuring external/toolchain include or library inputs, users explicitly refresh: buildlog configure --fresh -C build project with the intended user files, presets and configuration selections. This bypasses the unchangedconfigure fast path, seeds and cached probe answers, and executes the reached requests. It refreshes those answers, not every old cache entry; other affected configurations or newly enabled checks also need a fresh configure. Disabling seeding alone does not bypass answer-cache reuse. For these probes, (FC) includes the stable-unobserved-environment assumption; validating observations does not validate their completeness. Changes must be visible through the recorded identity fields. A kind without a fingerprint has no key: its answers are never cached or seeded, and it runs in every configure. At the end of a configure, the driver records every answer of the run with its key, a digest of the composed program, and a digest of the round-0 input other than answers (𝐴, 𝑈 , the packages’ facts). A kind 𝑘 is guarded if every rule that reads one of its result relations, positively, negatively or inside an aggregate, binds the result’s identifier, in the same disjunct, in a positive atom of req𝑘 or of a relation all of whose rules bind their first argument that way. The loader checks this syntactically for every kind that does not declare itself unguarded, with a stated reason (W3). The shipped prepared union has no unguarded package kinds: selection reads fixed available metadata instead. The generated pending rules read a result negatively, joined with its request, so they are guarded too. After bounded preparation and one composition, the driver proceeds as follows (run_fixpoint). The generic schedule still accommodates explicitly justified unguarded plugins; with shipped guarded kinds it simply answers all pending requests. (1) Seed. Take the record for the current program, else the latest one, and keep the answers whose kind exists, whose key is in the cache, whose watch set is unchanged and whose key, recomputed against the kept answers, is unchanged. The run is a replay if the program and the round-0 input other than answers are unchanged and every recorded answer is kept. The record lists withdrawn requests (step 4); records without that list use their replayable flag; otherwise it is seeded, and the answers of unguarded kinds are dropped. (2) Rounds. The kept answers are added to 𝐸 0 , unconfirmed, except that replay confirms the recorded withdrawn answers, including unguarded ones. In each round, after the checks, a seeded answer is confirmed if its request is in 𝑀𝑖 and its key, recomputed against the confirmed answers only, is unchanged; this is repeated until nothing changes. A seeded answer whose request is in 𝑀𝑖 but is not confirmed is stale and is dropped, and a round that drops one answers no request: the next round computes the requests again without it. Otherwise, if a request of a guarded kind is pending, the round answers only the pending guarded requests; otherwise it answers the pending unguarded ones. A request that waits is not kept: the next round computes the requests again from its own model. Requests are answered from the cache when their key is there and its watch set holds, and otherwise by the probe, against a snapshot of the confirmed answers. The run stops when nothing is pending. (3) Fallback. If a replay meets a pending request, a stale answer, or a seeded answer left unconfirmed whose request did not arise, it is abandoned, and the configure runs again

28

Alex Reinking

as a seeded run from the same record. If a run that started with seeds fails a check, it is abandoned, and the configure runs again without seeds and reports that run’s outcome. (4) End. When nothing is pending, the seeded answers that were never confirmed are removed from the final input facts, and the record is written. It holds every answer of the run that remain after pruning, including confirmed answers whose requests were later withdrawn, and lists those withdrawn requests. Records are kept separately for each composed program. A fallback re-evaluates the same program; it never composes a larger one. Before publishing success, the driver confirms the preparation observations and rejects any used file, root or rule module outside the certified union. Final locks include explicit packages and finally used modules only. What is written when a configure fails depends on where it fails. A failure before emission (the loader rejects the composed program, the lock does not hold, a driver check or a probe fails, or preparation confirmation fails) stops the configure and leaves the build directory’s previous Ninja file in place, stale with respect to the inputs. If the final model has errors, configure still writes the fact files, metrics and lock, deletes the Ninja file and exits with failure. With --keep-going, errors attributed to a target or action instead become edges that print the error and fail when built, the rest of the graph is emitted and configure succeeds; errors not attributed to a target or action still delete the Ninja file. The regeneration edge of an emitted Ninja file depends on the files the configure read, not on probe answers, so a change that only a probe would see takes effect at the next explicit configure. The results below use (RL), (A), (FC), (FL), (I) and (CK) as stated in §4.2. Throughout, an answer is the set of rows that one call gives for one pair (𝑘, id); every result row carries that pair’s identifier, including rows retained from an earlier configure. This answer-row ownership (RL) is an obligation on probe authors: the driver checks for a matching primary row and declared relations, but does not check every secondary row’s identifier. We write 𝑀 (𝐸) for 𝑀𝑃 (𝐴, 𝑈 , 𝐸), 𝐺 and 𝑁 for the guarded and unguarded kinds, and 𝑀 ≈ 𝑀 ′ if two models agree on every relation other than the probe results. Emission and the error report read only relations other than the probe results, so models that agree in this sense have the same outcome. This agreement excludes retained probe-result rows and the final answer-input files: guarded seeding can skip a transient request that a fresh run answers. The example above exhibits this difference. Equality of the previous and fresh final input facts is not a premise or conclusion of Corollary 4.4. The confirmation invariant concerns provenance and correctness, not persistence of requests. An executed answer has a request in the model of its probing round. A normally confirmed seed has a request in the confirming round and an unchanged key computed from confirmed prerequisite answers, with valid watches. A replay’s recorded withdrawn answer has the recorded run’s certificate instead; it need not have a request in the replay model. Subsequent rounds retain these certificates when requests withdraw. Unconfirmed guarded seeds remain tentative and are removed if never confirmed. What (W3) checks. layers._check_answer_reads checks each result atom’s identifier variable against a positive, top-level request atom with exactly that variable in the same body disjunct. It also admits auxiliary guards: starting from requests, it certifies a relation only if every clause entails an already certified guard with the head’s identifier variable. Ground facts and accepted, user or driver input relations cannot certify auxiliary guards; aggregate-local atoms and atoms inside parentheses cannot certify positive guards. Thus nested disjunctions cannot borrow a guard from another branch. The check also traverses Soufflé’s expanded initial AST, so macros and includes cannot hide result reads or bypass auxiliary-guard certification. Induction on this certification establishes

Meta Build Systems as Logic Programs

29

request entailment, including for negative and aggregate result reads. This is a sound, conservative syntactic sufficient condition for semantic guardedness: it may reject semantically valid joins with identifier equalities, parenthesized guards or more involved implications. Unguarded declarations are explicit opt-outs and receive no speculative seeding. Identifier stability and fingerprints. (I) is not enforced across configures. The cache key is exactly the kind, the entire argument tuple and the fingerprint (discovery.cache_key), so changing arguments prevents reusing the old answer even for the same identifier. A simultaneous collision with two tuples is rejected in that round. Neither behavior proves the cross-configure stability required by Theorem 4.3; a violating plugin cannot invoke that theorem. Secondary-row ownership (RL), (FC) and (FL) remain plugin obligations; violating them can invalidate seeding equivalence without being detected. In (FL), “earlier answers” are prerequisite answers in the acyclic requestdependency order: every derivation of the request uses their rows. Confirmation follows this dependency order, not a chosen ordering of independent probes. Under (A), the fixed-answer function 𝛼𝑘 (𝑟 ) replaces the snapshot-dependent 𝛽𝑘 (𝑟, 𝐸) used by fresh determinism; these are distinct functions with distinct premises. Lemma A.3 (Fixed answers for the shipped kinds). If the shipped probe kinds satisfy (P3), they satisfy (A). Proof. The inventory kinds of the C/C++, Emscripten and NDK plugins read no earlier answer, so by (P3) each answers its one constant request as a function of the environment. Every other shipped probe reads, among the earlier answers, only inventory rows about the toolchain and platforms that its request names (a toolchain’s tools, a platform’s triple, SDK and constraints). Only an inventory answer states a toolchain or platform (by the shipped domain rules), so every derivation of the request uses those rows. A round that answers requests has dropped no stale answer, so its unconfirmed seeds are inert (Lemma A.4 below) and its requests are those of the model over the confirmed and probed answers, which form the snapshot. The rows a probe reads are thus in its snapshot, and they are the inventory’s fixed answer. By (P3), each other probe’s answer is then a function of its request and the environment. □ Checks over every correct-answer subset. For the shipped rules, domain membership is structural, not an induction limited to the fresh schedule. The arguments below fix 𝐴, 𝑈 , the environment and the finite package answers allowed by the theorem. Let 𝑉 contain all their input values, the shipped rule constants and all correct inventory values. Finiteness of configurations, path derivations and template expansions follows from Lemma A.7. Deleting correct answers may expose negated branches, but cannot introduce values outside those finite sources. Each domain is therefore contained in a fixed finite universe even over arbitrary subsets. Inventory, Emscripten inventory, NDK inventory. Each request and domain uses the same constant identifier and the same config_decl premise. Their universes are singletons, there are no arguments, and their probes return a primary row: the build-machine row for C/C++, a status row for Emscripten and NDK even when no toolchain is found. cc_capability. The request copies its domain, formed from the finite toolchain, language and platform sets. Negated cross-mismatch and built-toolchain tests only filter this product. The probe returns a yes/no primary row for every tuple. cxx_std. The request copies its domain, a subset of inventory toolchains times the finitely stated lattice_rank standards. Its yes/no answer always has a primary row. cc_warning. The request copies its domain, a subset of toolchains times the two languages and the finite cc_default_warning flags; its probe always returns a yes/no primary row.

30

Alex Reinking

cc_implicit_include. The request copies its domain, toolchains times the two languages. The primary result includes an empty-directory row when there are no include directories. cc_check. The request copies its domain of finite cc_check_want tuples; negating cc_check_stated only removes tuples. Subjects, headers and argument words are drawn from the fixed finite input and derived configurations. Every completed probe returns a primary yes/no row; the optional size row uses a declared secondary relation. file_archs. The request copies its domain, one tuple per derived imported file path. These paths come from finitely many package answers and inputs. The primary format row is present even for an unknown format; architecture rows belong to its declared secondary relation. python_interp. The domain uses the finite input interpreter paths; the request only filters it by python_wanted. A missing interpreter returns a primary “found=no” row. python_package. The domain is the finite product of interpreter paths and stated distribution/module/ specifier tuples; wanted and found-interpreter premises only filter it. A primary “found” row is returned even when no package is found. All these implementations return only their declared result relations. Thus domain membership, answer totality and declaration checks hold over all correct subsets. The tuple-uniqueness part of (CK), and (I), require collision-free identifiers. Every shipped multi-argument kind builds its identifier by length-prefixing each field but the last (len:value:), so the identifier is injective in the argument tuple by construction, whatever characters the arguments hold: subject a|b with headers c and subject a with headers b|c get distinct identifiers. Single-argument kinds are injective trivially. Third-party kinds still carry the obligation: they must be injective and preserve domain coverage to use the theorem. These per-kind arguments discharge all-subsets (P2) for the shipped composition, not arbitrary extensions of its open relations. Lemma A.4 (Inert answers). Let 𝑃 be stratified and satisfy (F) and (RL), let 𝐸 be a finite set of answers, and let 𝑋 be a finite set of answers of guarded kinds. If no request answered in 𝑋 holds in 𝑀 (𝐸), or none holds in 𝑀 (𝐸 ∪ 𝑋 ), then 𝑀 (𝐸) ≈ 𝑀 (𝐸 ∪ 𝑋 ). Proof. Write 𝑀 = 𝑀 (𝐸) and 𝑀 ′ = 𝑀 (𝐸 ∪ 𝑋 ), and suppose that no request of 𝑋 holds in 𝑀 ◦ , which is one of the two. We show by induction on strata that 𝑀 and 𝑀 ′ agree on every relation other than the probe results. Let the strata below 𝑠 agree. A rule instance of stratum 𝑠 that reads a row of 𝑎 ∈ 𝑋 , positively, negatively or inside an aggregate, has in the same disjunct a positive premise 𝑔(id (𝑎)), where 𝑔 is req𝑘 or a relation all of whose rules bind their first argument in req𝑘 ; so 𝑔(id (𝑎)) holds in a model only if req𝑘 (id (𝑎)) does. If 𝑔 lies below 𝑠, it agrees in 𝑀 and 𝑀 ′ , and it is false in 𝑀 ◦ , hence in both. If 𝑔 lies in stratum 𝑠, consider the iterates 𝐽0 ⊆ 𝐽1 ⊆ · · · of the stratum’s immediate-consequence operator over 𝑀 ◦ ’s lower strata, which reach 𝑀 ◦ ’s stratum 𝑠. Each 𝐽𝑚 lies inside 𝑀 ◦ , so 𝑔(id (𝑎)) is false in it and the instances that read 𝑋 have a false positive guard (aggregate contributions are unchanged); the operators for 𝐸 and for 𝐸 ∪ 𝑋 therefore agree on every 𝐽𝑚 , and the two least fixpoints coincide. In either case stratum 𝑠 agrees, and the induction closes. □ In the shipped rules, a guard relation other than the request is always a lower one, but the proof does not need this. Guarded discovery. Throughout this characterization, fix a composed 𝑃, 𝐴, 𝑈 and environment and finite universes U𝑘 of request tuples. Each identifier determines one argument tuple across these universes (I). Every 𝛼𝑘 (𝑟 ) is a correct, finite answer with a primary row and only declared result relations; (RL), (F), (A), (P2) and (CK) hold for every model on subsets of these answers.

Meta Build Systems as Logic Programs

31

In particular, all requests of those models belong to U𝑘 , not merely the requests of a fresh run. Quantification over answer sets below is only over subsets of these fixed answers, not arbitrary result rows or stale seeds. Fix a correct set 𝐹 of answers of unguarded kinds. A correct set 𝐸 of answers of guarded kinds is closed over 𝐹 if every answer in 𝐸 is 𝛼𝑘 (𝑟 ) for its request 𝑟 , and every request of a guarded kind that holds in 𝑀 (𝐸 ∪ 𝐹 ) is answered in 𝐸. Generalized least-closure statement. Let 𝐺 be the guarded kinds. Under the hypotheses above, sets closed over 𝐹 exist and all give the same model off probe-result relations, denoted 𝑀𝐹 . Then 𝐸 𝐹∗ = 𝛼 (req𝐺 (𝑀𝐹 )) is the unique least correct closed set over 𝐹 . This proves Theorem 4.3 by taking 𝐹 = ∅ and all kinds guarded. Proof of the generalized Theorem 4.3. Existence. Let 𝐸 0 = ∅ and 𝐸𝑖+1 = 𝐸𝑖 ∪ 𝛼 (req𝐺 (𝑀 (𝐸𝑖 ∪ 𝐹 ))). Each 𝑀 (𝐸𝑖 ∪ 𝐹 ) is finite by (F), and by (P2) the identifiers answered lie in a finite set, so the chain stops at a set closed over 𝐹 . Uniqueness. Let 𝐸 1 and 𝐸 2 be closed over 𝐹 , and let 𝑋 = 𝐸 2 \ 𝐸 1 . If the request 𝑟 of some 𝑎 ∈ 𝑋 held in 𝑀 (𝐸 1 ∪ 𝐹 ), then 𝐸 1 would answer it with 𝛼𝑘 (𝑟 ), which is 𝑎 by (A); so no request of 𝑋 holds in 𝑀 (𝐸 1 ∪ 𝐹 ), and Lemma A.4 gives 𝑀 (𝐸 1 ∪ 𝐹 ) ≈ 𝑀 (𝐸 1 ∪ 𝐸 2 ∪ 𝐹 ). Symmetrically 𝑀 (𝐸 2 ∪ 𝐹 ) ≈ 𝑀 (𝐸 1 ∪ 𝐸 2 ∪ 𝐹 ). Call the common model, up to ≈, 𝑀𝐹 . Least closed set. Let 𝐸 𝐹∗ = 𝛼 (req𝐺 (𝑀𝐹 )), which is well defined, since requests are not probe results. For any 𝐸 closed over 𝐹 , 𝐸 𝐹∗ ⊆ 𝐸, and the requests of 𝐸 \ 𝐸 𝐹∗ do not hold in 𝑀 (𝐸 ∪ 𝐹 ) ≈ 𝑀𝐹 , so by Lemma A.4 𝑀 (𝐸 𝐹∗ ∪ 𝐹 ) ≈ 𝑀𝐹 ; hence 𝐸 𝐹∗ is closed over 𝐹 and 𝛼 (req𝐺 (𝑀 (𝐸 𝐹∗ ∪ 𝐹 ))) = 𝐸 𝐹∗ . A correct set 𝐸 of answers with 𝛼 (req𝐺 (𝑀 (𝐸 ∪ 𝐹 ))) ⊆ 𝐸 is closed over 𝐹 , so it contains 𝐸 𝐹∗ . □ The operator 𝐸 ↦→ 𝛼 (req𝐺 (𝑀 (𝐸 ∪ 𝐹 ))) need not be monotone: an answered request can withdraw another request. The proof obtains leastness among correct closed sets by inertness and model agreement, not by applying Knaster–Tarski to this operator. Guarded reads entail positive request dependencies. Within a stratum a cycle of such guards cannot justify itself: every request needs a finite least-derivation tree rooted outside the cycle. Negative and aggregate dependencies on derived relations must go to lower strata. Together these facts prevent two guarded, self-consistent closed sets from sustaining mutually withdrawing requests; Lemma A.4 is the precise stratum-induction argument. Lemma A.5 (What a round’s model is). Under the generalized least-closure hypotheses above, additionally assume (FC) and (FL), and let a run of the driver reach a round 𝑖 that drops no stale answer and in which no request of a guarded kind is pending after confirmation. Let 𝐹 be the unguarded answers of 𝐸𝑖 . Then 𝑀𝑖 ≈ 𝑀𝐹 , and the confirmed and probed guarded answers of 𝐸𝑖 are closed over 𝐹 . Proof. Every answer that the run gave by calling a probe is 𝛼𝑘 (𝑟 ) by (A), and every answer taken from the cache is too, by (FC). A confirmed seed is as well. By (FL) and the guard, the answers on which its key depends answer requests that hold whenever its own does, so, by induction along derivations, they are confirmed before it, and its key, recomputed against answers equal to 𝛼, is the key of 𝛼𝑘 (𝑟 ); by (FC) and (I) the seeded rows are 𝛼𝑘 (𝑟 ). Split 𝐸𝑖 ’s guarded answers into the confirmed and probed ones, 𝐶, and the unconfirmed seeds, 𝑋 . A seed whose request holds in 𝑀𝑖 is confirmed or stale, and the round drops no stale answer, so no request of 𝑋 holds in 𝑀𝑖 = 𝑀 (𝐶 ∪ 𝑋 ∪ 𝐹 ), and Lemma A.4 gives 𝑀𝑖 ≈ 𝑀 (𝐶 ∪ 𝐹 ). Every guarded request of that model holds in 𝑀𝑖 , is not pending and is not answered in 𝑋 , so 𝐶 answers it: 𝐶 is closed over 𝐹 , and 𝑀𝑖 ≈ 𝑀𝐹 by the generalized least-closure result. □ Optional unguarded plugins. For the unguarded kinds, define 𝐹 0 = ∅ and 𝐹 𝑗+1 = 𝐹 𝑗 ∪𝛼 (𝑄 𝑗 ), where 𝑄 𝑗 is the set of requests of unguarded kinds that hold in 𝑀𝐹 𝑗 and are not answered in 𝐹 𝑗 ; let 𝑚 be the first 𝑗 with 𝑄 𝑗 = ∅. The sequence is defined by 𝐴, 𝑈 and 𝛼 alone, and stops by (P2). It is a schedule,

32

Alex Reinking

not a fixpoint characterization. Consider two unguarded requests with req(𝑎) ← ¬ found (𝑏) and req(𝑏) ← ¬ found (𝑎), where each answer is found. Both {𝛼 (𝑎)} and {𝛼 (𝑏)} are sets whose model asks for nothing else, and neither is contained in the other, so there is no least one; the schedule answers both at once and ends with 𝐹 1 = {𝛼 (𝑎), 𝛼 (𝑏)}, in whose model neither request holds. This illustrates the generic API’s limit, not shipped package selection, which reads fixed available metadata and uses no unguarded probe. Answering unguarded kinds before guarded closure also loses schedule independence. For example, a constant request req𝑔 of a guarded kind and req𝑛 ← req𝑔 , ¬res𝑔 of an unguarded kind satisfy the guard on the negative read of res𝑔 . Before 𝑔 is answered, 𝑛 is pending; afterwards it is absent. If 𝑛 was answered early, its unguarded result remains observable; if 𝑔 was answered first, 𝑛 never runs. Waiting for guarded closure chooses the latter consistently, including when 𝑔 is a confirmed seed. Proof of Corollary 4.4 (cached and fresh configures agree). Checks and progress. A fresh run contains only correct fixed answers, so (CK) makes its checks pass and Theorem 4.1 completes it. Tentative seeds need not be correct: a seeded run may fail a check despite (CK) for correct answer subsets. The driver then reruns unseeded, obtaining the fresh outcome. It remains to consider runs whose checks pass. A round that drops a stale seed probes nothing. In every other probing round, confirmation makes the active seeds equal to 𝛼 by (FC), (FL) and (I); the unconfirmed seeds have absent requests and are inert. Requests therefore lie in the finite universes of the theorem. A round that defers unguarded requests answers a guarded one, so a run makes only finitely many probing rounds and seed-removal rounds. Fresh and seeded runs. Neither seeds an unguarded answer, so a run’s unguarded answers change only in rounds that answer unguarded requests, and in such a round no guarded request is pending. By induction on these rounds, the 𝑗th of them starts with unguarded answers 𝐹 𝑗 : by Lemma A.5 its model is 𝑀𝐹 𝑗 , so its pending unguarded requests are 𝑄 𝑗 , it answers all of them, by (A) and (FC) with 𝛼, and its unguarded answers become 𝐹 𝑗+1 . The last round has nothing pending, so by Lemma A.5 its model is 𝑀𝐹𝑚 . The removal of unconfirmed seeds at the end changes the model only up to ≈, by Lemma A.4. Probe order and the snapshot do not enter, as in Theorem 4.2. Replays. Induct over completed records for each fixed composed program. The invariant is stronger than outcome agreement: a record contains the canonical unguarded answer set 𝐹𝑚 , correct guarded answers 𝐶 closed over 𝐹𝑚 , and the answers to every prerequisite used to obtain or confirm those retained answers. It need not contain the fresh run’s transient guarded answers. Fresh and guarded-seeded runs establish this invariant by the phase argument above. Pruning removes only never-confirmed seeds, not an answer used by a probing or confirming round. Thus the record retains every guarded phase certificate needed for its unguarded schedule. Replay keeps the recorded program, non-answer input and all answers, and validates every key and watch against the retained answer snapshot. Induct on the acyclic prerequisite order from (FL): each recorded prerequisite remains present, its answer is correct by the induction hypothesis, and (FC) makes the equal-key cached answer equal to the current 𝛼. This argument includes withdrawn answers of both guarded and unguarded kinds; it uses their historical request certificates, not a request in the replay model. The recorded phase certificates therefore reproduce the canonical package schedule 𝐹 0, 𝐹 1, . . . , 𝐹𝑚 under the current oracle. A completing replay has nothing pending, so its correct guarded answers 𝐶 are closed over 𝐹𝑚 . Its model is 𝑀 (𝐶 ∪ 𝐹𝑚 ) ≈ 𝑀𝐹𝑚 and its record preserves the invariant. In particular, withdrawn unguarded answers are retained as part of 𝐹𝑚 , not discarded by the inert-answer lemma, which applies only to guarded kinds. A replay that deviates is abandoned before it calls a probe or writes a record. The seeded run that replaces it keeps no confirmation and no unguarded answer of the replay, and starts from the record’s guarded answers alone, so it is a seeded run as above. Without (CK). A run with seeds that fails a check, whether a

Meta Build Systems as Logic Programs

33

seeded run or one that replaces a replay, is replaced by a run without seeds, and only the retry’s check failures are reported. This says nothing about outcome equivalence for cached runs that never trigger fallback, or about which fresh intermediate check they would reach. □ A completed replay reconstructs the recorded final input, not necessarily the fresh final input. The record invariant supplies the missing link: canonical unguarded answers and correct guarded closure imply agreement off probe results. The same argument applies to records written by guarded-seeded runs and, by induction, to replayed records. Proof of Proposition 4.5 (bounded preparation). Fix the finite provider graph, including metadata includes, manifest requirements and rule pointers. Its reachability operator 𝑇 (𝐿) = 𝐿 ∪ links(𝐿) is inflationary and monotone because its edges are fixed. Every nonterminal iteration adds a vertex, so at most |𝑉graph | − |𝐿0 | strict growth steps are possible. By induction every iterate is contained in every link-closed superset of 𝐿0 ; the terminal iterate is therefore the least one. These are Preparation.terminates, closed and least in Lean. Complete enumeration and the relation between the graph and actual filesystem observations remain provider/implementation obligations. The driver rejects conflicting executable code and never adds a vertex in response to an inference request. □ With every environmental kind guarded, Stratified.fixed_union_closure specializes least guarded closure to 𝐹 = ∅; CachePhase.fixed_union_agreement derives the same canonical model from a completed confirmation certificate. These do not verify Python certificate extraction or module-guard insertion. Available declarations may affect conditions; dormancy suppresses effects, not availability itself. The seeding tests compare seeded and unseeded configures of the cross-compilation example after narrowing and widening its configurations and after invalidating one recorded answer, and find the derived facts, the final input facts and the emitted graphs identical. Further tests compare a seeded and a fresh configure after a dependency appears, after one disappears and after a package pin, prefix or file changes, under shuffled probe orders, and test that a check failure in a seeded run falls back, that a round with a stale answer probes nothing, that a replay that meets a pending request reruns seeded, that inactive answers are pruned from final provenance, and that uncertified generated roots or files fail without recomposition. Additional tests cover dormant modules, strict unused-code conflicts, metadata-only instances, relative path spellings and late sysroots with negative lookup invalidation. An unchanged warm configure can validate its certificate and skip inference altogether. (A), (FC), (FL) and (I) are obligations on probe authors, like (P3). A.2.1 Module-guard rewriting. The loader makes the availability/binding/use separation explicit in the rules. For example, Qt’s authored clause source_claimed(t,f) :- qt_input(t,f,"rcc",_). becomes source_claimed(t,f) :module_used("QtCore-id",_), qt_input(t,f,"rcc",_).

Here "QtCore-id" abbreviates the stable manifest identity; private qualification is omitted. Declaration clauses instead receive the corresponding module_bound guard. Helpers inherit their consumers’ stratum, and every head, fact payload and disjunct is guarded. Thus availability does not activate a package, and binding does not wait on its actions. Typed tool references in the core derive the tool configuration used by the fribidi example of §3.1: tool_dep(c, g) :- target_action(t, c, a), action_runs(a, r), tool_resolves(t, r, g). needed(g, e) :- tool_dep(c, g), exec_config(c, e).

34

Alex Reinking

A.3

Consequences of the Stratification

Definition A.6 (Well-formed composition). A composed program 𝑃 is well-formed if (W1) 𝑃, with the generated pending rules, is stratified; (W2) every probe kind’s domain is finite in the sense of (P2); (W3) every probe kind whose answers are seeded beyond full replay is guarded; (W4) no request, domain or discovery-time check relation depends on a completion-gated rule head or on complete; (W5) the decision relations are answer-free; and (W6) each pair (𝑘, id) has one argument tuple. The loader generates pending(𝑟 ) ← req𝑘 (𝑟 ), ¬answered𝑘 (id (𝑟 )) for each kind. The consolidated enforcement and obligation table is Table S4. Proof of Proposition 4.6 (requests are decided before discovery). In a stratified program, the extension of a relation in 𝑀𝑃 (𝐷) is determined by the facts of 𝐷 in the relations it reaches in the dependency graph, stratum by stratum. A decision relation reaches no probe-result relation, so its extension in 𝑀𝑃 (𝐴, 𝑈 , 𝐸𝑖 ) equals its extension in 𝑀𝑃 (𝐴, 𝑈 , ∅) for every 𝑖, fixing 𝑉 throughout. This uses W5 for the full 𝑃. For the authored core, its clauses for the decision relations read author relations (requests, request conditions, declared and conditional kinds, declared configurations), user relations (option values, the selected configurations) and two derived relations: an option’s effective value, defined from the user’s value and the author’s default, and the evaluator of request and kind conditions, which descends into the subterms of conditions written in 𝐴 and reads only effective option values. This evaluator is separate from the per-configuration one that general conditions use, and a request or kind condition that tests anything other than an option, such as whether a target is defined, is an error when the specification is loaded. None of these relations reaches a probe-result relation. □ Plugins and rule packages may add clauses to request and request_all, which are open. After the engine checks the guarded union’s types and stratification, the loader checks authored clauses without their implicit module guards for the W5 dependency condition: an edge runs from a rule’s head to every relation in its body, positive, negated, or inside an aggregate, and a path from a decision relation to a probe-result relation is rejected with the chain of rules that forms it. The needed closure, the pending-request relation and the end of discovery all reach probe results, so a clause that makes a request depend on any of them is rejected, even when it reads it positively, which the engine alone accepts. This source-level check is not a certificate of W5 for the guarded union. The core, the C/C++ plugin, the Halide and Qt packages and every case study pass the check, and the 16 reference projects’ graphs are byte-identical with and without it. Preparation fixes 𝑃 before inference, including every available executable package. Module guards prevent unused packages from adding requests merely through availability. They can make package-derived requests depend on use, which can depend on answers. Such effects are outside the answer-free guarantee unless the full dependency graph independently satisfies W5; merely passing the loader does not establish that premise. Package-derived requests are included in these decision relations. A separate audit preprocesses each complete executable union, including scoped fact-payload bridges, generated source declarations and I/O rules, and applies the loader’s checker with all declared relations and probe results. All 13 audited study/SDK configurations pass, including both Halide scopes; Qt was not included in that audit. These are configuration-specific certificates, not a loader guarantee. The composition example (§C.6) deliberately includes an accepted exception: its use-gated self-request introduces the path request_all → module_used → build_platform → host_platform → res_host_platform. The predicate-level check fails even while the package is dormant; this is not a demonstrated wrong build. Audit inputs, diagnostics and reproduction commands are in notes/data/review-followup. A core error rule reports a request for a target whose option gates all fail (an answer-free rule, so (W5) is unaffected). A second rule reports a

Meta Build Systems as Logic Programs

35

target that is needed, not requested, while its gates all fail; it reads needed targets, which may depend on answers, but derives only an error, never a request. Under that full W5 premise, target kinds and explicit requests remain answer-free throughout the environmental rounds. Authored option values do not change when module use changes. Full statement of Proposition 4.7. Let a fixed 𝑃 be well-formed, let 𝑃 ′ remove complete from errorpropagation rules, let both satisfy (F), and let probes satisfy (P0) and (P3). Under (W4), including domains and every discovery-time check relation, discovery over 𝑃 and 𝑃 ′ makes the same requests, answers and driver-check outcome in every round. If discovery completes with answers 𝐸𝑛 , then 𝑀𝑃 (𝐴, 𝑈 , 𝐸𝑛 ) and 𝑀𝑃 ′ (𝐴, 𝑈 , 𝐸𝑛 ) have the same errors and attributions. Proof of Proposition 4.7 (errors do not steer discovery). 𝑃 and 𝑃 ′ differ only in the propagating rules. By (W4), neither requests nor domains nor any discovery-time check relation reaches a changed rule head or complete. Their reachable rules are identical, so their extensions and all relation-based checks agree in each round. The loader checks the expanded AST’s dependency reachability through positive, negative and aggregate reads, protecting every completion-gated rule head conservatively, not just the core’s error heads. The protected roots include every manifest request and domain. Primary-answer and declared-result checks read returned Python rows, not additional model relations. By induction on rounds, the two discoveries compute the same 𝑅𝑖 and, by (P3), the same 𝐸𝑖+1 ; they stop in the same round 𝑛 with the same answers 𝐸𝑛 (and fail the same check, if one fails). The stated (F) for both programs and (P0) ensure finite evaluation and returning calls; (W2) ensures finite progress. If discovery completes, in 𝑀𝑃 (𝐴, 𝑈 , 𝐸𝑛 ) no request is pending, so complete holds and the gated rules fire as the ungated ones of 𝑃 ′ do; the two models agree on every error relation, and on the targets and actions the errors are attributed to. □ Rule inspection for Invariant 2 (tool configurations). The relevant rules in L1_targets.dl and L2_toolchains.dl are: exec_config([p,s],[h,e]) :- base_config([p,s]), host_platform(h), exec_settings(s,e). exec_config(e,e) :- exec_config(_,e). tool_ref(t,c,a,r,u) :- action_run(a,_,_,r,u), target_action(t,c,a). tool_ref(t,c,a,r,u) :- action_run_item(a,_,_,r,u), target_action(t,c,a). tool_dep(t,c,g) :- tool_ref(t,c,_,r,_), tool_resolves(t,r,g). tool_dep(t,c,g) :- needed(t,c), target_toolchain(t,tc), toolchain_tool_target(tc,_,g). needed(g,e) :- tool_dep(_,c,g), exec_config(c,e). The settings rules implement the per-key tool policy. Resolving an action’s tool reference therefore supplies exactly its tool configuration to the last rule. Conversely, that last rule requires a tool_dep premise, whose only two sources in the core are the action references and built-toolchain association printed above. This is minimality of the direct tool-induced edge, not “needed if and only if run”: an explicit request, a test or an ordinary dependency can independently need the same target, and the built toolchain rule demands every associated tool before individual actions are known. The latter can include a tool no emitted action actually runs. The property tests in tests/test_core_invariants_prop.py check both directions of the scoped invariant. Staging and raw actions. Negation and aggregation read complete lower-stratum extensions; Qt’s finalization therefore sees every lower fact. Adding facts back from above is unstratifiable and rejected. Input checks read relations. The -Werror check reads words of user-selected programs’ actions, not inside words; other rule-action flags remain the author’s obligation.

36

A.4

Alex Reinking

Finite Evaluation for the Shipped Rules

Polynomial data complexity for fixed-program Datalog [84] does not bound constructed terms: 𝑛 recursive cat(𝑠, 𝑠) applications yield length 2𝑛 , and ℎ two-valued template parameters yield 2ℎ expansions. Each round’s fixed stratified program has polynomial data complexity only without such construction; §6.4 measures cost. The argument below establishes only (F), not an arbitrarypackage bound. (F) is not checked, and term size has no run-time limit; it is an obligation on whoever writes rules. The loader’s gated-recursion check rejects some unbounded constructions, but the argument below does not rely on it. A constructed term is a symbol, record or number that a string functor, constructor, arithmetic, to_number or an aggregate produces. A constructed term inside a recursive component needs variables bound outside it, a strictly progressing column, or the core’s template expansion to pass that check. Lemma A.7 (Shipped rules have finite evaluation). The core, the C/C++ plugin, and the Halide and Qt rule packages satisfy (F), and hence the finiteness hypothesis of the standard model fact (§4.1). The lemma does not cover a project’s own rules (zlib-ng’s, for instance), nor the Emscripten, NDK and Python plugins, which we have not audited. Proof. Fix a finite set of answers. Soufflé’s numbers have a fixed width, so only symbols and records can grow without bound. A non-recursive constructing rule builds finitely many terms from finitely many body tuples, so along the fixed stratum order it keeps every relation finite. It remains to bound the components in which a constructed value flows back, through a dependency cycle, into a column of the same component. A column-level scan of the shipped rules (scripts/construct_sites.py) over-approximates these cycles. Each is finite: • Ordered joins (the core’s, and Halide’s feature string) build one suffix per rank of a group. The recursion is gated on the group being well-formed: a tie in rank, an item with two ranks, an unranked item, or two separators is reported as an error and derives no suffix. • Template expansion (two copies in the core) starts only for a row whose placeholders are all closed, declared and bound for the instance, which a walk over the row’s positions checks. It carries an injective, length-prefixed encoding of the values chosen so far, so every partial expansion is a prefix of one of finitely many complete choices over the finitely many bound values. A template that is itself an instance, directly or along a chain, does not expand, so an expanded value is never expanded again. • Configurations have one name per suffix of a declared settings list. A setting key with two tool-configuration policies or values is gated, so the tool map is a partial function; it is idempotent (also checked), so it adds at most one configuration per declared configuration and build-machine platform. • Second linkage instances append a fixed suffix along a chain bounded by the linkage names that facts state. • Generated-file paths join a directory and a relative path; the cycle is between relations only, since paths into a package’s data feed action arguments and inputs, never the properties they are read from. Every gate that a recursion negates is evaluated in a stratum below it, except the template walk, which walks positions, not choices. Each ill-formed input is still reported as an error. The remaining components build lists of bounded length or count up to a bound stated in the rule. □

Meta Build Systems as Logic Programs

A.5

37

Built and Imported Artifacts

An export is derived at the exporter, and an import at the consumer from the files the exporter wrote; the two share no facts. The loss of §4.4 is visible only at the exporter. A foreign format 𝑓 has a spelling table, stated by its plugin, that spells each key as a field or declares it unspelled with a reason. For an exported component 𝑚, built as 𝑡 in configuration 𝑐, let own(𝑡, 𝑐) be the properties 𝑡 gives its consumers itself, excluding build-internal keys, and req(𝑡, 𝑐) its exported requirements on sibling components or on imported packages by name and minimum version. Let loc map buildand source-tree paths to paths relative to the install prefix, and usage(𝑡, 𝑐) be the usage facts a consumer derives from a dependency on 𝑡 in the build, through 𝑡’s own properties and transitively through its requirements. Lemma A.8 (What an export states). In 𝑀𝑛 , for every exported component 𝑚, configuration 𝑐 in which it is exported, and active format 𝑓 , at least one of the following holds for each fact (𝑘, 𝑣) ∈ own(𝑡, 𝑐), and exactly one if 𝑀𝑛 derives no error: the export spells it in 𝑓 , with a path value mapped by loc; or 𝑓 declares 𝑘 unspelled, and the exporter derives a loss fact for (𝑚, 𝑘, 𝑓 ) and a configure warning; or the exporter derives an error. Every requirement in req(𝑡, 𝑐) is stated, or is an error when it names a built target outside the package or an imported target whose package has no name. In each foreign format, shipped rules 𝑅 are reported as a loss, with a warning. Exclusivity needs the error-free premise: a key both spelled and declared unspelled derives an error, but the spelling and loss facts still coexist in that erroneous model. The downstream-use remark has five conditions, for 𝑡 and the components it requires. (E1) No loss. In 𝑓 , no loss fact is derived; in buildlog’s format this holds by construction. (E2) Inversion. parse 𝑓 (spell 𝑓 (𝑢)) = 𝑢 for every fact 𝑢 whose key 𝑓 spells, with paths resolved relative to the file the importer reads. (E3) Resolution. Every requirement resolves at the consumer to the export of the same component or imported package for the same configuration. (E4) Isolation. The consumer’s own properties, other dependencies and user facts are unchanged. (E5) Rule neutrality. At the consumer, 𝑅 derives no usage fact about the package’s targets. Remark 2 (Set-level downstream use; Remark 1 in full). (i) Facts. For an error-free export under (E1)–(E5), a consumer that imports the export of 𝑡 in format 𝑓 for configuration 𝑐 derives, from its dependency on 𝑡, the set of usage facts loc(usage(𝑡, 𝑐)). Without (E1), under (E2), the property rows the importer reads for each exported component are its spelled rows, that is, loc(own(𝑡, 𝑐)) less the facts with lost keys, and the consumer derives no loss fact; what the consumer derives from those rows is not characterized. (ii) Rules. In buildlog’s format the consumer’s program contains 𝑅, as in-tree; a foreign format carries none of it. Ownership discharges (E4) for shipped rules, except their actions. (E5) is an assumption that nothing checks: ownership lets a package’s rules add usage facts to its own targets. Hand-written packages (LLVM, Qt) have no built counterpart and are outside the remark. The remark equates sets, so order and multiplicity are outside it. (E2) and (E3) are tested, not proved (Table S5 and buildlog’s own format below). Proof of Lemma A.8 (what an export states). By the rules of the export layer: a property is spelled when the table spells its key (and, for keys with enumerated values, its value); the loss fact is derived from an exported fact, an active format and the table’s unspelled entry, and the warning from the loss fact; a key that is neither spelled nor declared unspelled, a value with no spelling, a rooted path under no install location, and an exported edge to a non-exported built target are each

38

Alex Reinking

Table S5. Round trips tested in the submission. “Facts”: the downstream’s derived usage facts are compared, as sets, with those it derives in-tree. “Consumer”: a foreign consumer builds and runs against the install. Package

Format

Result

nlohmann/json, two variants nlohmann/json

CPS, CMake pkg-config

facts equal, also after moving the prefix facts equal except the language standard, a loss the exporter derives facts equal (CMake’s .pc also lacks the definition)

nlohmann/json, CMake’s in- CMake export stall two-component fixture CPS, CMake zlib, shared and static

CMake package

Halide, CMake’s install

CMake export

three fixtures (14, 10 and 8 facts) DSL fixture

buildlog buildlog

facts equal, including an inter-component requirement consumer: upstream’s find_package test builds and passes; a request for the next major version is refused the import states every fact that a hand-written binding states the importer’s rows equal the exported facts as multisets up to the prefix, also after copying the install its shipped rule builds and runs a downstream; read through CPS alone (a CPS-only search) it does not configure

an error. A static library’s link-only requirements, and native kinds other than static and shared libraries, are errors as well. The loss fact for shipped rules is derived from an exported rule package and an active foreign format (export_rules_lossy). □ Why the conditional set-level observation holds. By induction on the requirement graph of the export. For a component, by Lemma A.8, the export being error-free, and (E1), each fact of own(𝑡, 𝑐) is spelled (no loss alone leaves the error alternative open), and by (E2) the importer turns it back into loc of that fact. By (E3) each requirement resolves to an export for which the induction hypothesis holds. The consumer’s propagation rules are shared by built and imported targets, so, with (E4), the facts it derives from the dependency are those of the database it reads, and by (E5) the shipped rules add no usage fact to them. Without (E1), (E2) still applies to every spelled row, and lost rows are absent; how the consumer’s rules combine the remaining rows is not characterized. Part (ii) holds by construction: buildlog’s format installs 𝑅 unchanged, and the loader loads it as it would in-tree; a foreign format carries no rules. Two configurations that would install different exports to one place are a configure error; version acceptance and absolute paths outside the package (kept, not relocatable) are outside the remark, and metadata the CMake importer cannot read is an error. The CMake importer reads FRAMEWORK targets and the generator expressions that installed export files use; metadata it cannot read (object libraries, unknown compile features, other generator expressions) is an error of that target, not a silent drop. It reads Qt’s own Qt6*Targets.cmake, which the Qt study’s packages list in their manifests. buildlog’s own format. An install writes <prefix>/share/buildlog/<Pkg>/: a manifest, a facts file <Pkg>.facts.dl of ground facts in a pkg_* vocabulary (packages, components, locations, requirements and properties by buildlog’s own keys, with paths relative to the prefix, which is found from the file’s location), and the project’s rule layers if its specification names them (export_rules). The facts are derived from the same export relations as the CPS, pkg-config and CMake files, so the format has no spelling table and nothing unspelled. The file is Soufflé input as it stands: a test runs Soufflé on it with a generated header of declarations and gets the same tuples

Meta Build Systems as Logic Programs

39

back. The round trip of Table S5 compares tuples as multisets; it excludes absolute paths outside the package (pkg_prop_abs, stated but not relocated) and metadata (compatibility, description, required versions), which the CPS importer skips too. It is a tested property, not a proof. The format has no conditions: a package installed from several configurations must state the same facts in each. Preparation enumerates the manifest, its facts, imports and executable rules within the declared roots. The rules enter the checked union before environmental inference; available facts are bound and used under the module guards. The final lock pins explicit packages and finally used modules by content, while the observation certificate also covers dormant code and data. A relocated package has the same content hash; an edited locked package is an error until the user accepts it. A decision relation reading a probe answer is a W5 error, and the visibility and layering checks apply as to any package. why on an imported fact ends at the line of the installed facts file; it does not continue into the upstream project’s derivation, which the exporter does not keep. A manifest may also list nearby export files of other formats (imports), which are handed to their importers, so an upstream whose install has only CMake exports can ship a hand-written manifest and rules beside them; the files must stay inside the prefix, and the lock covers finally used modules. Preparation enumerates and decodes these imports without probe answers; their includes and rule pointers are part of its finite closure. Binding and module use select their effects within the checked stratified union. Preparation enumerates every candidate in every declared search directory; two candidates for one name are an error until the user pins one, never a first match, and package_file names an exact manifest, the interface by which a resolver hands buildlog its choice. When one install writes both a CPS and a buildlog export, the CPS file names its sibling manifest (x_buildlog_manifest, a prefix-relative path). The CPS importer verifies the marker and states a format-neutral row that the two files are one package, so the core sees one candidate, and a plain prefix search binds the buildlog route, facts and shipped rules. This is identity, not precedence: no format outranks another. A third party’s unmarked CPS file beside a manifest is ambiguous until pinned, and a dangling or mismatched marker is an error, not a fallback. (A CPS file can still name a rule package, x_buildlog_rules, for hand-written or third-party exports.) Halide’s LLVM, Clang and LLD and Qt’s CMake packages are found this way: each has one hand-written manifest that imports the package’s own export file (LLVMExports.cmake, ClangTargets.cmake, LLDTargets.cmake, Qt6*Targets.cmake). Package-level facts, such as LLVM’s version, definitions and RTTI setting, are published through the open package_version and package_attr, and LLVM’s 31-line rule layer derives the C++ ABI properties of every target the import defines; Clang and LLD require the LLVM version they were built with. The loader rejects a package whose rules assert about a target outside the namespaces its own imports define (import_ns_target), and a property the export and the rules state differently is an error, not resolved by precedence. For macOS’s LLVM 22 the three packages are 132 lines, 37 of them Datalog, and no Python.

Provenance. An inner node of a proof tree is a rule instance; its positive premises are its children and are explained in turn. Its negated premises, built-in constraints and aggregate results are leaves, so a proof does not show why a negated fact is absent or which tuples an aggregate counted; why-not explains an absent fact one rule at a time. The other leaves are input facts, with their origins (a file and line, or the probe request that produced it), and fact clauses of layers. An installed fact’s proof stops at its installed facts file. A tree deeper than Soufflé’s limit is cut and marked as truncated.

40

B

Alex Reinking

A Survey of Meta Build Systems

Table S6 describes twelve build and packaging systems along eleven axes, from how they discover the environment (A) to how closely they resemble a logic program (K). It is descriptive: each cell summarizes the system’s documentation, and the artifact gives the source of every cell. Every system with usage requirements or providers computes a monotone closure of the kind §2.2 shows (column B), although none describes itself as a logic program. The columns also show how the systems differ around the closure: most interleave discovery with declaration (A), several resolve choices by an order the user does not see (G), and few model compatibility (F). C

Further Evaluation Data

This section gives the evaluation data that §6 summarizes: the portfolio, the spec-size accounting and table, the categories of difference per study, the full account of libHalide’s differences, which comparisons keep order and what an order-keeping comparison finds, further capabilities (a built toolchain, C++ modules and CUDA), the pins needed on Linux, the sizes of why’s answers, and configure API measurements. The machine, versions and method are those of §6.1. C.1

The Portfolio

Table S7 lists the case studies with their pinned releases, their baselines and the capability each isolates. C.2

Spec Size

Line counts compare unlike things unless one decides what each side is billed for. We decide by asking whether comparable tools ship a piece of logic in their core. Logic that CMake, Meson or Bazel provide built in (path manipulation, a module that an executable loads without linking it, joining flags, argument-vector templates, one configured-file formatter) lives in buildlog’s core and is not billed to projects. Project-specific conventions are billed: test conventions, ISA tables and score weights, a generator’s argument vector. A port ports intent, not another tool’s features; fribidi’s config.h, written by Meson without a template, becomes a template that the project owns and pays for. Rule packages are reusable library code, like a CMake module or a .bzl file: they are reported separately and not counted in project size. The same rules apply to the baselines, whose helper modules and .bzl files are counted as library code where upstream ships them as such. We report per study, not a pooled ratio. Sizes are counted by a script in the artifact: non-blank, non-comment lines of every TOML, Datalog and template file of the project, skipping lines that hold nothing but source paths (argument words, flags and names count) and skipping presets, which are user input. Table S8 gives the project-billed size of each study’s specification. Upstream builds usually cover more (more platforms, install, packaging, more tests); where only part of an upstream build is in scope we count that part, or give the study’s estimate, marked ∼. For zlib-ng and ggml a script (scripts/upstream_lines.py) counts the in-scope part by rule: from the files that hold the ported logic it drops the branches, helper functions and commands of the platforms, backends and features the port leaves out, with the same line measure, which reproduces flatbuffers’ 481. Some 20 to 30 lines it keeps may still be out of scope. Where the upstream count covers a comparable scope (SPIRV-Tools by the study’s estimate, ggml and zlib-ng by count), the specification is shorter. fribidi’s is longer than its Meson build, largely because the configured header’s template, which Meson generates from a dictionary, is billed to the project. The Bazel slice’s 49 lines compare with 19 at Bazel’s use site plus about 130 of rule library, and nanobind’s 17 with upstream’s 16. What remains in Datalog is project abstraction (zlib-ng’s source sets and directory-wide properties, ggml’s variant

none (exec_script) one nonTuringcomplete pass configure metaoperation phased†

GN

read all, then build

Pants v2

SCons

build.rs

Nix/Guix one lazy evaluation Spack facts, then solve

Cargo

Autotools shell script

one DICE graph memoized rules

Buck2

Bazel

build2

Meson

interleaved, cached

CMake

A. Discovery

sys: packages, same surface cc_import gives CcInfo

no imported kind interchangeable

IMPORTED, same surface

fixpoint, optimization

splicing

feature union

none

no distinct kind external or built, one spec

n/a

no distinction

none (environ- no distinction ments)

same providers† typed parame- distinct types† ters, inference

transitive sets

CcInfo, depsets

metadata protocol

public configs, second phase dependency objects†

closure of INTERFACE_*

B. Propagation C. Imported vs. built

one envicustom ronment per builders config one build/ none host/target per run one target; build.rs proc-macros † on host many platderivations forms solved jointly n/a NP-complete

user code

SemVer

checks only

none found

none in engine solver objectives

none; flake cache† reused concretizations

lockfile

cache off by default

PATH order backtracking order

Starlark, BXL

Starlark

modules

store builder own installer

.lp files, recipes

rustc

Make

overlays

crates

m4 macros

programmable own executor

own, remotefirst local, Docker, remote

own, remote

own executor

Ninja, IDEs

Ninja

template built-in modules

Make, Ninja, IDEs

J. Backend

modules, toolchain files

memoized rule plugins graph

DICE

dependency tracking

most refined select ambiguity is an error

ALL/ANY†

Skyframe

first-found tools

first-match toolchains

no validation

full reconfigure

H. Meta-level I. Extension incrementality

full regeneration pkg-config, regeneration CMake, frame- rule works, in order three-tier persistent import search configuration

none

package search order

G. Hidden choices

constraint matching

avoided†

none

generator

in module, recipes

none found

COMPATIBLE_ INTERFACE_*

custom command, wrapped by hand action

platforms, rules, genrule exec/target, transitions per-node exec prelude rules platform environments† sandboxed

many toolchains one config per directory; three machines many toolchains

one toolchain per tree

D. Toolchains, E. Codegen to F. Compaticonfigs library bility

pure functional answer-set program

backtracking search

no fact base

finer than Bazel static Hornlike, no backtracking mostly imperative

closure, ordered search

named closure

closest to a fact base

closure only

closure only

K. Resemblance to LP

Table S6. Twelve build and packaging systems along eleven axes. Each cell summarizes the system’s documentation; the sources for every cell are in the artifact. Twenty cells were checked against primary documentation. Cells marked † could not be confirmed against primary documentation. Spack’s column F follows Gamblin et al. [16].

Meta Build Systems as Logic Programs 41

42

Alex Reinking

Table S7. The case-study portfolio. Every study compares against the upstream project’s own build at the pinned release, whose sources are a pinned git submodule. Project

Release

Baseline

Capability isolated

zlib

1.3.2

CMake

Halide

pinned main

CMake

nlohmann/json flatbuffers

3.12.0 25.12.19

CMake CMake

flatbuffers (slice) fribidi

25.12.19 1.0.17

Bazel 8.8.1 Meson 1.12.1

zlib-ng

2.3.3

CMake

ggml SPIRV-Tools nanobind_example Qt consumer

0.25.3 2026.3 pinned commit Qt 6.11.3

CMake CMake scikit-build-core CMake

configure checks, configured headers, install and export a DSL whose generators run during the build; configurations header-only library; install/export round trip a code generator that must run on the build machine tool configuration against cfg = "exec" native: true derived; a project-owned config header per-source ISA flags; universal2 from one configure per-ISA variants as run-time-loaded modules code generated from an imported package’s data Python extension ABI, abi3, wheels rules a library ships for its consumers (moc, rcc)

Table S8. Project-billed specification size in lines, under the accounting policy of §C.2. “DL” is the Datalog part of “Lines”; rule packages are library code, reported separately. Study

Lines

DL

Rules

Upstream

Scope of the upstream count

nlohmann/json zlib flatbuffers

37 88 217

0 2 10

– – –

– – CMake 481

flatbuffers/Bazel fribidi zlib-ng

49 301 523

1 47 91

– – –

19 Meson 263 CMake 1,223

ggml

501

115

–

CMake 644

SPIRV-Tools

220

8

–

CMake ∼590

nanobind

17

0

99

16

Qt consumer

26

0

116

CMake 13

2,293

502

690

–

not counted not counted also options, shared library, install, packaging use site; the .bzl rule path is ∼130 config.h template billed to the port in scope, of 2,241 in the same five files; upstream has 5 more architectures, MSVC, install, fuzzers in scope, of 1,728 in the same five files; ISA tables upstream keeps in C are billed here also install, other libraries, fuzzers, all tests CMake 12 + pyproject 4; the rule package matches nanobind’s CMake module one configuration there, four here (15 with one); the packages are Qt’s not counted; the rule package serves the apps

libHalide

scoring); architecture and extension knowledge is library code in the C++ plugin (about 220 lines), not billed to the projects. For the whole-build comparison in §5.1, scripts/spec_size.py counts

Meta Build Systems as Logic Programs

43

all top-level TOML and Datalog files in libhalide and the reusable generator rules, including Python and tutorial rules. It additionally removes fact rows that name only a source file with a derived name and constant columns, which CMake leaves implicit. The totals are 1,573 TOML lines, 502 project-rule lines and 567 reusable-rule lines, against CMake’s 3,797 project lines and 1,564 helper lines. The table uses the source-list policy above without this fact-row normalization. Fresh per-file counts and source hashes for both measures are in notes/data/spec-size-refresh. Like for like, the CMake generator-helper lines that implement what buildlog’s generator rules model number 495, against 292 lines of those rules; the count of modeled lines includes 317 lines of scaffolding we did not assign to one feature, which favors CMake. C.3

Fidelity in Detail

Table S9. Recorded action pairing; the full Halide row uses the current native validation. Scope counts ported upstream targets of all targets, not a denominator for unmatched actions. Paired units use their worst difference: spelling, warnings/includes, or potentially behavior-changing flags (distinct differences in parentheses). “Out.” counts changed outputs in baseline-flag replay; n.r. means not rebuilt. Units in both builds Study (baseline)

scope

paired

spell.

warn./incl.

Compiles, paired by target and source zlib (CMake) 6/6 34 0 flatbuffers (CMake) 6/6 85 0 fribidi (Meson) 15/15 42 0 zlib-ng (CMake), arm64 10/11 90 90 x86_64 10/10 110 110 ggml (CMake), CPU 5/42 28 0 arm64 9/12 60 0 x86_64 31/34 236 0 nanobind (scikit-build-core) 2/2 12 0 Actions, paired by output (libHalide: release) libHalide (CMake) full 4,748 2,814c Actions, paired by configuration role, type, and source or output name flatbuffers/Bazel 8.8.1, cross 17/49 49 0

In one only flag

out.

base

buildlog

4 0 0 0 0 0 0 0 0

30 (1) 85 (2) 42 (2) 0 0 28 (2) 60 (2) 236 (2) 12 (3)

0 3 0 0 0 0 0 0 0

0 0 0 0 0 38a 4a 4a 0

0 0 0 0 0 0 1b 1b 0

538

1,396 (17)

n.r.

4,221d

86e

0

49 (23)

n.r.

13f

0

a Objects of targets not ported. b An example upstream skips with run-time backends. c 870 classified as identical. d 4,203

phony edges and 18 non-phony actions; 331 install/housekeeping edges excluded. e 75 configure-time export lists/stubs; remaining classes described below. f Archives: Bazel’s per library, buildlog’s per configuration. Full Halide includes Python bindings and apps; full-build output impact is unmeasured.

Categories of difference. A script (scripts/fidelity_taxonomy.py) reads each study’s normalized records, pairs them by unit as §6.1 describes, and classifies every token in which a pair differs. Spelling is what normalization removes: the compiler’s path (Xcode’s shim against the resolved clang), -arch against --target with a sysroot, paths in the build tree, dependency-file flags, the order of flags and, outside libHalide, of link inputs, and a tool spelled buildlog -E against cmake -E. Every other difference has a category (Table S10). A pair is semantic if it has a difference of a category other than diagnostics, include and include class; the three are inert as long as both builds read the same headers, which the shadow check below tests. Semantic is a property of the flag’s category, not a finding that code differs: most semantic flags reach no code, as the list after the table shows. Table S9 calls semantic pairs flag pairs. Each semantic category, by study:

44

Alex Reinking

Table S10. Paired units by category of difference. Spell.: identical or differing in spelling only. A pair can have several categories. L/I/O: link flags, inputs, other. Sem.: pairs with a semantic category; inert: pairs whose only differences are diagnostics and include categories. Study zlib flatbuffers fribidi zlib-ng arm64 zlib-ng x86_64 ggml CPU ggml arm64 ggml x86_64 nanobind Bazel slice

Paired Spell. Lang. Def. Opt. Codegen L/I/O Diag. Incl. Class Sem. Inert 34 85 42 90 110 28 60 236 12 49

0 0 0 90 110 0 0 0 0 0

– 30 85 58 – – – – – – 22 26 48 56 191 221 12 1 – 44

– – 42 – – – – – – 44

– – – – 18 – – – – – – – – – – – – –/11/– 46 2/5/46

– – 42 – – 6 12 45 – 44

– 43 12 – – – – – – 45

4 15 11 – – 17 46 211 12 –

30 85 42 0 0 28 60 236 12 49

4 0 0 0 0 0 0 0 0 0

• zlib. CMake defines NO_FSEEKO on every compile, from the generator-expression bug of §2.3; no compiled file reads it. • flatbuffers. The project asks for C++11. CMake keeps Apple clang’s default level, C++14, because it satisfies the request, and spells it -std=c++14; buildlog passes -std=c++11. The project builds and its tests pass as C++11. CMake also passes FLATBUFFERS_TEST_PATH_PREFIX, which only the tests read, to 58 compiles through a directory-wide add_definitions, and an empty $BUILD/samples include directory to 43. • fribidi. buildlog adds -DNDEBUG, which no fribidi file reads, and -fPIC to the library’s objects, which is the default on Darwin. Meson adds -Wall -Winvalid-pch -fdiagnostics-color and each target’s source directory. • ggml and nanobind. CMake passes -std=gnu++17 where the project asks for C++17, and buildlog passes -std=c++17; CMake defines target_EXPORTS on shared libraries’ and modules’ objects, which no source reads. ggml’s CMake adds -Werror=implicit-function-declaration -Werror=implicit-int to C compiles. nanobind’s 11 inputs are its library’s sources, which CMake compiles in place in the interpreter’s site-packages; buildlog compiles only sources under the project or the build tree, so its rule package copies them there first. • Bazel slice. Bazel’s default macOS toolchain adds -O2 -g0 (where the configuration asks for -O3), -fstack-protector, _FORTIFY_SOURCE, redacted __DATE__-like macros, -fdebug-prefix-map and -frandom-seed for reproducibility, its own warning set, and, on the sample’s target compiles, DEBUG without -g, where buildlog passes -g. These change code; they are Bazel’s toolchain’s choices, which the study does not replicate. • libHalide. The 438 compiles of the runtime’s embedded bitcode are C++ files that hold one byte array each. CMake compiles them with only its configuration’s flags and -std=c++17; buildlog gives them libHalide’s flags and C++20, as the library they belong to. buildlog models CMake’s -O3 -DNDEBUG on link lines and Halide’s wipe_standard_flags (which strips them from the tests) as two properties of the Halide spec. The current full-build comparison below covers the test compiles without CMake’s precompiled header; libHalide’s rpath names the LLVM it was found with where CMake names lld’s. What differs in the full build. The full build’s libHalide graph (release; the Python bindings, tutorials, apps and tests included) pairs 4,748 of CMake’s actions with buildlog’s, by output and,

Meta Build Systems as Logic Programs

45

where the directory layouts differ, by target, action type and file name: 1,002 links, 2,236 compiles, 299 archives, 1,195 generator runs and custom commands, 15 copies and a symbolic link. 2,814 differ at most in spelling, 538 only in warnings or include directories, and 1,396 in a flag that can matter, 17 distinct differences. The classes: 730 test compiles that CMake gives a precompiled header; the 438 byte-array wrappers described above; 110 compiles of shared and module libraries that CMake gives -Dtarget_EXPORTS (34 of them -flto, on the Python runtime and module); 75 links of tutorials, Python modules and tests that differ in -headerpad_max_install_names, the rpath or -search_paths_first; 7 links where buildlog also links a library’s own runtime archive; libHalide’s rpath; and 35 custom commands, 26 of which start a Python generator through env, 8 list the generator’s target features in another order, and one asks for one output fewer. 4,203 of CMake’s 4,221 unpaired actions are phony edges; the other 18 are tools and fixtures outside the port, tutorial generators that buildlog names differently, the precompiled header and install copies. buildlog has 86 actions CMake lacks, 75 of them export lists and stubs that CMake writes at configure time. The full-build comparison is on macOS. The scoped replay below measures wrapper and PCH effects, not the output impact of every full-build command difference. Native configuration sharing. The native Python preset makes tools inherit python.interpreter, so generators and products share one Halide instance. Previously the tool policy reset that setting to none, duplicating Python-independent C++ work. The emitted graph shrinks from 6,857 to 4,874 edges: 1,983 repeated steps disappear, including 661 C++ compilations. The single configuration also resolves path-matching ambiguities for four tutorial-generator compiles; the paired total rises by four, all warning/include-only. This is an explicit native policy, not automatic per-target setting projection. The refreshed graph comparison is in notes/data/halide-inherit; CMake’s unchanged graph is retained from the preceding native refresh. Tutorial correction and native refresh. The pinned upstream build applies test/’s flag wiping and hidden visibility only to tests, not to tutorial/. The port incorrectly reused test_defaults for ordinary tutorials, lesson 10’s runner, tutorial generators and generated-library runners. Removing those four dependencies restores -O3 -DNDEBUG in Release compile/link commands and removes hidden-visibility flags. The rules explicitly retain upstream’s C++17 minimum, which lesson 10’s runtime-only consumer requires. Four command regressions cover these properties in the four rule families. All 27 tutorial compiles in the current pairing fall in the warning/include-only class. Tutorial links retain ordinary linker/rpath differences. This refresh does not measure flag effects on performance or code size, nor repeat the Linux execution run. The tutorial-correction evidence is in notes/data/author-revision; the subsequent configuration-sharing refresh is in notes/data/halide-inherit. For the non-Halide, non-Bazel studies, baseline-flag replay rebuilds each semantic compile pair with buildlog’s command and the baseline’s semantic flags, at the same output path. A repeated original command checks determinism. The changed-output counts are in Table S9; they apply only to the pairs replayed. Fresh current-graph replay. We replay all 438 wrapper and 730 PCH-related compile pairs from the completed single-composition native graph. Each current command runs twice, then once with the semantic intervention, at the same isolated output path. All 3,504 invocations succeed and all original repeats agree. All 438 wrappers and 728 PCH-related compiles give identical objects; two do not. For PCH, we rebuild CMake’s exact generated header under each current command’s compiler, target and options (51 contexts), then add it to that command. This isolates the header/PCH choice, not every upstream flag or reuse of a serialized PCH from another build. The two differing tests, for_each_element and halide_buffer, include HalideBuffer.h, not

46

Alex Reinking

Halide.h; adding the latter through the PCH introduces static-initialization sections. Their text sections grow from 33,668 to 40,584 bytes and from 241,040 to 247,952 bytes, respectively; isolated reruns reproduce all three object hashes in each case. We do not infer runtime equivalence or a performance effect. Complete commands, hashes, compiler identities and diagnostic objects are retained in notes/data/halide-current-replay. Excluded Bazel actions. In flatbuffers’ Bazel slice, 254 housekeeping actions (symbolic links for include paths, runfiles trees, build information) and 4 actions that build Bazel’s toolchain wrappers have no Ninja counterpart and are excluded from the comparison. In an optimized build buildlog shares one tool instance with the target configuration, 7 actions fewer than Bazel, which always separates the two. Which comparisons keep order, and why the others may drop it. Order matters on a command line in three places: the include search path, where the first directory with a header wins; the link line, where a static library is searched only for symbols already undefined; and a repeated definition, where the last -D wins. The libHalide comparison keeps all three: compiles compare flags as a multiset but the include path in order, and links, archives and generator runs are compared token by token in order; its self-test checks that a reordered link is reported. zlib’s comparison checks the include directories in order. The other comparisons treat flags as sets and sort link inputs, for two reasons that hold in these studies. First, the order inside one include class differs by design, as above, so an ordered comparison would report every compile without finding anything; what makes this safe is that both builds read the same file. The taxonomy script checks it: for every header that two include directories of one compile command hold, it finds the file each build reads, from the command’s directories and the quoted-include rule. In every compile study both builds read the same file, except in flatbuffers’ 27 test compiles, where 8 generated headers exist both in the build tree and checked in, buildlog reads the generated copies and CMake the checked-in ones, and each pair of copies is byte-identical. The Bazel slice and libHalide, which compares include order, are not checked this way. buildlog also enables clang’s -Wshadow-header where the compiler accepts it, which the Apple clang of these runs does not. Second, every macOS link in these studies is done by Apple’s linker, which keeps searching a static library until no new symbol resolves (its manual page: “there is no need to specify a static library multiple times”), so the order of libraries does not decide which members are loaded. buildlog derives the order of libraries on a link line from the dependency graph (§3.2), which is what a single-pass GNU linker needs, and every study links there on Linux; those that run tests pass them (§5). Set comparison would miss a macro defined twice with different values; the studies’ functional checks would catch one that changes behavior, but a difference in performance or code size that no check observes would go unnoticed. The taxonomy script checks this case too: in the three studies where a flag is repeated with different values (-O3 -O2 in zlib-ng’s buildlog build, -DNDEBUG -UNDEBUG in ggml’s two builds, -O3 -Os in nanobind’s two), the last value is the same in both builds. An order-keeping comparison. Table S10 folds order into spelling. A second script (scripts/fidelity_order.py) keeps order and classifies each paired command as identical in order, different only in order (the same tokens as a multiset), different in content only, or different in both (Table S11). It then tests each difference in order where order can matter: include directories that both hold a header the compile reads, a definition given conflicting values, and static archives on a link line, or an archive’s position among objects. An include directory in a build tree is listed in that build’s own tree, and two headers of one name in different places count as the same if their bytes are equal. Object files and dynamic libraries are left out, since Apple’s linker resolves those in a two-level namespace whatever their order. In these comparisons no difference in order is a

Meta Build Systems as Logic Programs

47

Table S11. Paired commands under an order-keeping comparison. Order: the same tokens in a different order. Both: order and content differ. Candidates: differences in order that could change the result. Study

Commands

Paired Same Order Content Both Candidates

zlib compile/link 34/6 flatbuffers compile/link 85/6 fribidi compile/link 42/15 zlib-ng arm64 compile/link 90/10 zlib-ng x86_64 compile/link 110/10 ggml CPU compile/link 28/5 ggml arm64 compile/link 60/3 ggml x86_64 compile/link 236/3 nanobind compile/link 12/2 Bazel slice compile 49

0/0 0/1 0/0 0/1 0/0 0/0 0/0 90/1 0/0 110/1 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0/0 0 0

0/2 34/3 0/1 85/4 0/7 42/8 0/3 0/6 0/3 0/6 0/0 28/5 0/0 60/3 0/0 236/3 0/0 12/2 49 0

0 0 0 0 0 0 0 0 0 0

candidate. zlib-ng’s compiles differ only in the order of independent flag groups, and the other compile studies’ differences in order interleave independent groups beside the content differences of Table S10. Every include order is decided. In flatbuffers’ 27 test compiles the source tree and the build tree both hold 8 generated headers, in different orders, so the two builds read different copies; the copies are byte-identical. ggml’s build directories share no header name with its source directories. buildlog orders a link line by its dependency edges, a library before what it needs, with ties broken lexically. A test asserts this order transitively on emitted link lines, and another links and runs a project with a chain, a diamond and a runtime-style archive under GNU ld on Linux. These are therefore checks of the emitted order under a single-pass linker, separate from command-pair comparisons. A third test builds A → B → C with B and C each static, shared or header-only and private, public or interface edges (12 cases). In all 12 the link line and whether C’s include directory and definition reach A follow CMake’s usage requirements: a static library passes on its private dependencies’ archives, a shared library hides them, and only public and interface edges pass on compile requirements. Each case also links and runs under GNU ld on Linux. zlib-ng and zlib. zlib-ng’s pairs differ in spelling only and zlib’s do not, though both are CMake builds of the same kind of library. zlib’s CMake build adds a definition through a generatorexpression bug and moves zconf.h’s directory between include classes; zlib-ng’s adds nothing to a compile beyond what buildlog’s specification states, and both builds repeat no flag differently. The study’s own comparison, which drops include flags and -O3, reports no difference either; the uniform script above keeps them and agrees. Halide’s full build. buildlog builds libHalide and runs 941 of the 950 CTest tests that upstream’s build defines at the pinned commit, across the correctness, performance, generator, warning, fuzz and runtime tests, the four autoschedulers’ tests (Adams2019, Li2018, Mullapudi2016, Anderson2021), the C++ and Python tutorials, the Python bindings and the apps. With native tools inheriting the Python setting, there are 941 executions of 941 distinct tests; the lesson-10 AOT generator no longer runs twice. The completed native build gives 848 passes, 93 skips and no failures (arm64 macOS, Release, Homebrew’s LLVM 22, Python 3.10.19 with NumPy 2.2.6, imageio 2.38.0 and pybind11 3.1.0). Skips cover unavailable GPU, Hexagon and WebAssembly runtimes and the Anderson2021 GPU demos. Nine distinct tests are not modeled. Six drive a nested build inside ctest (lesson 15’s generator build and file check, and four Python lessons); in buildlog their outputs are ordinary targets of the one graph. Two drive a debugger, outside the port’s Release

48

Alex Reinking

Table S12. Halide’s cross-built apps against CMake. “Same”: records whose key matches; HelloAndroid’s keys collapse its two ABIs. HelloWasm Records

CMake

buildlog

same

CMake

buildlog

same

9 15 15 30 6

9 15 15 30 6

9 15, identical 15, identical 30 6

8 4 4 8 2

10 4 4 8 4

4 4, identical 4, identical 4, identical 1

compiles generator runs runtimes archives links spec lines (+ project, preset) Ninja steps

HelloAndroid

138 (+13, +13) 75

61 (+13, +7) 30

execution scope. One, filter_dll_exports, runs a CMake script that filters DLL exports, which only MSVC builds use. The command comparison in Table S9 covers the whole native build, not just the cross-build validation sample. The cross build of libHalide. We cross-built libHalide, its runtime and the 32-test sample (one test per build feature) from arm64 macOS to Linux on AArch64, against a sysroot exported from the Linux image of §C.8, and ran the tests in that container. CMake needed two build trees and two configure invocations, with a partial build of the macOS tree (its exported generators, three buildtime tools and the autoschedulers) before the Linux tree could build. Beyond the Linux build’s flags, the Linux tree needed three standard settings (a toolchain file, the sysroot, compile commands) and workarounds: re-rooting the bundled dependencies’ search path; turning off the Python bindings and the tutorials; and three hacks, a script registered as CMAKE_CROSSCOMPILING_EMULATOR that runs each build-time program’s macOS twin (prefixed to 1,303 edges), and shadow packages for flatbuffers and for the imported generators. buildlog builds the same set in one tree from one configure: the generators and host tools for macOS and libHalide and the tests for Linux, in one graph. The tests give 30 passes and 2 skips, as under CMake, and the build needs no workarounds. The sysroot is handled by rules, not by settings: the core relation platform_sysroot names it, an imported file under it keeps its root, the CMake importer maps a run path under the sysroot to its path on the target (/usr/lib/llvm-22/lib, as in CMake’s build), and a .pc file’s absolute paths under a sysroot are prefixed with it, as pkg-config’s PKG_CONFIG_SYSROOT_DIR does. The user’s preset pins the host C++ compiler, since Apple clang and Homebrew’s clang both build for macOS; without the pin the configure is an error that lists both. buildlog’s x86_64 and universal2 configurations of libHalide are only configured, because Homebrew’s LLVM is arm64-only, and CMake’s builds of them fail at link. C.4

Halide’s Cross-Built Apps

Halide’s HelloWasm and HelloAndroid apps (§5.1) are compared with CMake builds of the same pinned sources by reducing each Ninja graph to records: compiles (target, source, flags), generator runs (name, Halide target string, parameters), runtime runs, archives and links, with machinespecific macOS architecture and SDK flags dropped (Table S12). HelloWasm. Upstream’s super-build builds the generator project with the host compiler through ExternalProject, configures the app under Emscripten’s toolchain file, and unrolls four wasm-32-wasmrt variants (SIMD and threads crossed) into separate targets, each with its own

Meta Build Systems as Logic Programs

49

generator runs and link. In buildlog the variants are configurations, where CMake, with one toolchain per build tree, unrolls them into targets: one index target and its three Halide libraries, each stated once, are built in four wasm32-emscripten configurations that differ in two settings, emscripten.simd and emscripten.threads, beside the host configuration that builds and runs the generator, all in one graph. The specification has 138 lines (96 non-blank, non-comment). It states the app’s own facts; the Emscripten knowledge is in the plugin: the link gets -O3 from the release optimization setting and -matomics from the threads setting, SDL2 is a package the plugin provides (emscripten::sdl2, giving --use-port=sdl2), and the plugin states each configuration’s CPU features in an open relation of the C++ package, which the Halide rule package maps to Halide’s wasm_simd128 and wasm_threads; it reads no Emscripten setting. Nothing is added to the compile lines. The Halide rule package mirrors CMake’s add_halide_generator and add_halide_library, with CMake’s defaults for the generator and function names and generator parameters keyed by condition. All four modules pass wasm-validate, and the generator project’s three native benchmark tests pass. Compiles differ from CMake’s only in include spelling: generated and Halide headers come through -isystem rather than -I, from one directory per library rather than per variant, since libraries are named per configuration rather than per variant. Other recorded deviations are on host lines or outside the graph: libpng and libjpeg come from pkg-config rather than CMake’s find modules, optimization flags are not repeated on host links, force-loaded archives and the macOS platform are spelled differently, RunGenMain.cpp is a listed source because the CMake importer rejects Halide’s INTERFACE_SOURCES, and the static web assets CMake copies are not modeled. Both builds use binaryen 123, since emsdk 3.1.73’s bundled version rejects what LLVM 22 emits. The demo draws to a browser canvas. A script (scripts/hellowasm_check.py) instead runs each of the four modules under Node.js for 64 frames of the app’s main loop, with a stub page whose canvas has no WebGL, so SDL draws with its software renderer. It compares the last frame with a native C++ program (scripts/hellowasm_reference.cpp) that drives the same three pipelines, built for the build machine by the same graph, as the main loop does. All four modules run the 64 frames and their last frames are byte-identical; against the native frame, 236 of 1,048,576 pixels differ, each by one unit in one channel. The demo is not run in a browser, and HelloAndroid is not run on a device. HelloAndroid. Upstream’s Gradle build runs its CMake build per ABI (arm64-v8a and x86_64, minimum API 23), which configures itself again for the host at configure time to build the two generators. Without Gradle, the baseline configures upstream’s native CMakeLists.txt directly with NDK 30’s toolchain file. buildlog builds the library in one configuration per ABI, and the host generators, in one graph, from a 61-line specification; the Android system libraries it links are packages the NDK plugin provides (ndk::log, ndk::android, ndk::atomic). Both libraries are ELF shared objects of the right machine, need only libandroid, liblog, libm, libdl and libc, and export all eight JNI entry points. Of the extra records, two compiles and two links are the generators, which CMake builds outside the ABI’s graph; the other compiles and links differ in the triple’s spelling (aarch64-linux-android23 against the NDK toolchain file’s aarch64-none-linux-android23) and in flags CMake’s target model adds (an export definition, -fPIC, -pthread). Gradle, APK packaging and running on a device are out of scope. What was added. The toolchain knowledge is in two plugins standing in for what the NDK and Emscripten would ship, as android.toolchain.cmake and Emscripten.cmake do for CMake. Counting non-blank lines outside comments, the NDK plugin has 43 lines of Datalog and 104 of Python, the Emscripten plugin 51 and 73; they are not counted as specification. The core gained three open relations (an executable suffix, a link side file and a toolchain’s link defaults), the

50

Alex Reinking

C++ package generic cross-build hooks, among them the open CPU-feature relation, and the Halide rule package the WebAssembly and Android targets and the CMake-like library forms. CPU microarchitecture knowledge in general, such as the inclusion of one level’s features in another’s, as Spack’s archspec records it, belongs in a generic layer between the core and the C++ package rather than in specifications; we leave it to future work. C.5

Further Studies in Detail

The paper (§5.3) gives each of these studies in one paragraph; this is the full account. zlib-ng. zlib-ng compiles each architecture-specific source with its own instruction-set flags and dispatches at run time. Its CMake build examines one architecture per configure, so a universal2 build of 2.3.3 silently builds no SIMD code in either slice and compiles an ARM-only source into the x86_64 slice (zlib-ng#1016). In buildlog the C++ plugin knows each architecture’s extensions and their spellings, the project states which each source group needs, and an incompatible placement is an error. From one configure each universal2 slice gets the same ISA sources and flags as a singlearchitecture build; the arm64 and x86_64 builds match CMake’s translation unit for translation unit (90 and 110, flags equal as sets), and generated headers, .pc files, archive members and dylib metadata are identical. GCC 13’s spellings match clang’s except one AArch64 extension; MSVC is not covered. ggml. ggml builds its CPU backend once per ISA level as a module the loader scores and selects at run time; upstream CMake copies one target per level. buildlog uses one template instantiated per level and a run-time dependency (§§3.2 and 3.6). The module sets (3 on arm64, 14 on x86_64), each level’s flags, symbol counts and load commands match CMake’s, and both builds load the same module. Upstream accepts a native tuning combined with all variants on ARM, producing three identical modules the loader cannot tell apart; buildlog reports an error. SPIRV-Tools. SPIRV-Tools generates its tables from JSON grammars in the separately installed SPIRV-Headers, which buildlog imports and whose grammars it reads as package data. Five generators produce six files, byte-identical to CMake’s, and the shared library exports the same 79 symbols; CMake’s optimizer library has 2,656 extra RTTI symbols from a directory-scoped -fno-rtti quirk that per-target properties do not reproduce. why traces a grammar read to the user’s line naming the package prefix, and pointing it at another release reruns exactly the four grammar-driven generators. nanobind. scikit-build-core drives CMake once per interpreter; in buildlog the interpreter is a configuration setting, and the stable ABI is one derived fact deciding the Py_LIMITED_API definition, the file name and the wheel tags together. For CPython 3.13 (abi3) and 3.11, the modules’ undefined Python symbols and exports equal the baseline’s, the wheels hold the same six files with byte-identical metadata, upstream’s tests pass, and the abi3 module also loads in 3.12 and 3.14. The Python plugin builds no source distributions or editable installs. zlib’s consumers. Upstream’s find_package consumer test passes with either install, CMake reads buildlog’s CPS export, and a consumer asking for the next major version is refused, as the compatible versions derive from the ABI version; upstream’s AnyNewerVersion file accepts it. C.6

Further Capabilities

The experiments of this section exercise capabilities beyond the eleven studies of §5: a toolchain built in the build, C++20 named modules and CUDA.

Meta Build Systems as Logic Programs

51

Independently packaged generators. The runnable examples/composition project installs two independent libraries, each exporting a runtime header and consumer-side generator rules, into separate prefixes. An ordinary consumer dependency on each runtime activates both generators without naming their rule packages; the resulting executable prints 42. A third valid rule package is composed but unused. Adding its search root leaves consumer actions and needed targets unchanged, excluding Ninja regeneration inputs; its warning and active lock entry remain absent. Explicit activation makes its warning, needed target and lock entry appear. A conflicting second installation and invalid dormant executable code both reject configuration. On macOS/Apple clang and Linux/GCC, each successful fresh configuration composes once and starts one evaluator. Singlerun preparation/configure observations are retained, not presented as repeated benchmarks. The example uses shell/sed generators, not a second industrial DSL. Its self-request fails the full-program W5 audit described in §A.3; accepted composition does not imply answer-free requests. Evidence and exact source identities are in notes/data/review-followup. TinyCC: a toolchain built in the build. A toolchain built with buildlog states its facts, as a library’s package file does. TinyCC 0.9.28rc bootstraps in one configure and one Ninja graph: Apple clang builds stage 1, stage 1 builds stage 2 as compiler, linker and archiver, and stage 2 builds stage 3. Each compiling stage builds its own runtime library. Stages 2 and 3 are byte-identical, as are their objects, and a program and library built by stage 2 run. One fact per stage gives what the inventory probe finds for an installed compiler, with targets instead of paths, and per target the stage that compiles it; the user pins only Apple clang. A built toolchain is never a candidate in toolchain selection, and its tool dependency (Invariant 2) is derived. The study runs on arm64 macOS only (Linux needs facts, not mechanism), and its reduced runtime lacks tcc -run. C++20 named modules. A module’s name is in its source, so which compile reads which module interface is known only after the sources are read. buildlog keeps this discovery out of configure. Each source is scanned during the build (P1689R5); a build-time stratum of Datalog rules in buildlogcpp, run by the same engine per target, collates the scans with the exported static facts into Ninja dyndep files, module maps and a provenance sidecar. The loader checks that no configure rule reads the stratum, so information flows one way and the theorems of §4 are unchanged: configure derives a graph whose edges the build completes. Each name has at most one visible provider; a collision, an import cycle or an import from a target that is not a dependency is an error, and an import never adds a dependency or a link edge. Consumers whose flags are compatible share one module interface per class; an incompatible consumer gets its own. import std is supported. why on an edge from a module interface to a compile joins the sidecar’s derivation, whose leaf is a scan fact, with the configure-time proof of the provider’s visibility. fmt 11.2.0, whose fmt.cc is one interface unit, builds and runs as import fmt with LLVM 22’s clang; the specification names no module, since the collator learns the name from the scan. Apple clang, which ships no scanner, is an error, not a fallback. CUDA. The buildlog-cuda plugin adds nvcc on Linux and changes nothing in the core or buildlog-cpp. stdgpu 1.3.0, in NVIDIA’s CUDA 13.4 arm64 image, was compared with CMake’s build: all 17 compiles (five library sources, three C++ and nine CUDA example sources) are identical as sets of definitions, include directories, flags and --generate-code specifications. The archive has the same inputs, and every one of the 12 programs links the same objects and libraries; CMake’s lines add CMake’s implicit device runtime, a second static runtime and an absolute librt.a, and order the system libraries differently. The programs are not run, as no NVIDIA GPU was available. The host compiler is the configuration’s unique C++ compiler or a user pin; two candidates without a pin are an error that lists them. cuda.arch names a set of architectures, and there is no native

52

Alex Reinking

detection, which would make the configured build depend on the machine’s GPU. Setting keys are ordered by declared priority, then by name, so independently written plugins compose. C.7

Provenance Answers

A proof is only useful if it is short enough to read. A raw proof tree is large, so the driver shapes it before printing. It shares repeated subproofs as a DAG, which does most of the reduction (a 703-node tree for one flag becomes 76 nodes). It also splices out engine-internal nodes, hides structural atoms, collapses single-premise chains of plumbing rules and, with --leaves, prints only the origins. By default why folds the steps that construct a configuration’s name and cites a premise already shown instead of repeating it. On the questions the studies’ authors asked, the default answers are 25 lines for why the x86_64 build needs flatc built for arm64 (9 with --depth 3), 29 for where the Bazel slice’s compiler flag comes from (59 with --with-demand, which adds the requests that asked for it), and 16 for why an instruction-set attribute is off in a configuration (a test bounds it at 16). Length is not the only criterion. Why zlib-ng compiles one source with -mavx2 takes 52 lines, because the answer shows the chain by which AVX2 requires SSE4.2, SSE4.1, SSSE3 and SSE2, as upstream’s build does, with each link’s option, check, flags, header and probe answer (29 lines), beside the source set (10), the configuration (9) and the C++ plugin’s ISA knowledge (3). A test bounds the answer at 53 lines and asserts that no unrelated premise (another configuration, a shared library, the ARMv8 condition) appears. Each answer ends in spec, user-file, probe or rule-package lines. Asked, in fribidi’s cross build for x86_64, why a table generator is built for arm64, why --leaves lists every origin of its 31-line derivation: $ buildlog why -C build --leaves 'needed("gen-bidi-type-tab", @arm64-macos.release.none)' project needed("gen-bidi-type-tab", <arm64-macos.release.none>) config_decl("release", "arm64-macos") ← project/spec.toml:5 config_decl("x86_64-release", "x86_64-macos") ← project/presets/cross-x86_64.toml:11 config_decl_setting("release", "native.opt", "release") ← project/spec.toml:6 config_decl_setting("x86_64-release", "native.opt", "release") ← project/presets/cross-x86_64.toml:12 config_select("x86_64-release") ← driver: config_select: --config on the configure command line gen_primary("table1(bidi-type, UnicodeData.txt)", "bidi-type.tab.i") ← project/gen.toml:93; project/gen.toml :6 gen_word("table1(bidi-type, UnicodeData.txt)", 0, "", "tool", "gen-bidi-type-tab", "") ← project/gen.toml:87; project/gen.toml:6 generator_label("table1(bidi-type, UnicodeData.txt)", "GENERATE") ← project/gen.toml:86; project/gen.toml:6 generator_owner("table1(bidi-type, UnicodeData.txt)", "tables") ← project/gen.toml:85; project/gen.toml:6 request_all("libfribidi") ← project/spec.toml:7 res_host_platform("inventory:default", "arm64-macos") ← probe inventory request "inventory:default" res_platform("inventory:default", "x86_64-macos", "x86_64-apple-macos13") ← probe inventory request " inventory:default" target("gen-bidi-type-tab") ← project/gen.toml:47 target("tables") ← project/gen.toml:39 target_deps("libfribidi", "public", "tables") ← project/spec.toml:91

The generator template’s word naming the program (gen.toml:87, instantiated at line 6) makes it a tool of tables, which libfribidi needs; the inventory’s answers name the build machine. No leaf says the program is a host tool. Presentation also has to undo an artifact of the engine. For a premise that only checks existence (“some toolchain targets this platform”), Soufflé records one arbitrary witness, and printing it suggests a dependency that does not exist. why therefore elides such witnesses in every view, including the focused ones that list only leaves or one path; the cross-compilation example’s leaf listing is 9 lines. The lattice join binds its value, so its candidate is a winner, not an arbitrary witness (§C.12).

Meta Build Systems as Logic Programs

C.8

53

Linux

The results below report scoped build and execution checks. The full native Halide command comparison is on macOS; no Linux Halide command-pair totals are reported. Platform coverage. The Linux studies use an arm64 Ubuntu 24.04 container image under GCC 13 and Clang 18, with the macOS specifications; each study’s record lists the platform’s deviations. The source studies include zlib, nlohmann/json (through a downstream build), zlib-ng, ggml, fribidi, flatbuffers, SPIRV-Tools, nanobind, the Qt consumer and libHalide with LLVM 22. The full Halide build and its test limitations are reported below. All 90 of zlib-ng’s translation units get upstream’s flags; fribidi’s 42 objects and 36 exported symbols match Meson’s; flatbuffers’ and SPIRV-Tools’ generated files are byte-identical; ggml’s flags match without filtering, as, under Clang, do its eight ARM variant modules (GCC 13 cannot build two of the levels); nanobind’s 12 compiles (bar one define), Py* symbols and wheel file lists match scikit-build-core’s (with Python 3.11.16 for 3.11.15). The Qt consumer uses Qt 6.11.3, in debug and release, with moc and rcc as host tools, and passes its two tests headless. In the Bazel slice (Bazel 8.8.1) flatc is built only in the tool configuration, its 37 compiles match Bazel’s exec compiles and the generated header is byte-identical to Bazel’s; there is no cross variant, since it targets x86_64 macOS and the image has no cross toolchain for x86_64 Linux. The Halide apps’ generator runs, runtimes and archives are identical to CMake’s (HelloWasm 15, 15 and 30; HelloAndroid 4, 4 and 4), their compiles and links have the same keys or the same deviations as on macOS, and HelloWasm’s three host benchmarks pass, as on macOS. HelloWasm’s host link has CMake’s -ldl and also -pthread, which CMake omits because its threads probe finds the threads library inside glibc’s C library; buildlog states the operating system’s flag rather than probing. The Android NDK’s host tools exist only for x86_64, so they run under emulation in the arm64 image, and both ABIs link. The specifications of nlohmann/json, nanobind, the Qt consumer, both Halide apps and the Bazel slice have no Linux-specific line. The others use conditions on the platform and the compiler family (CMake’s $<CXX_COMPILER_ID>), a check that runs a program, and an ELF version script beside Mach-O’s exported-symbols list. Package rules hold the rest: nanobind’s state ELF’s link and strip flags; an imported ELF shared library’s directory becomes an rpath, as CMake’s build rpath does; Qt’s OpenGL package states its link flag per platform; and a generated Halide runtime carries the operating system’s dynamic-loading library and threads flag, as add_halide_library adds them, from per-OS facts of the C/C++ plugin that are empty on macOS, WebAssembly and Android. Execution results. The source studies were exercised in the Ubuntu image and, where available, natively on macOS. GCC’s non-integration suite gives 1,180 passes, 121 skips and one expected failure; Clang’s suite gives the same totals. Clang’s C++ module tests require its matching scanner: using the installed Clang 22 and adjacent clang-scan-deps gives 12 passes and three skips. The test fixture selects this pair rather than the image’s default Clang 18 without a scanner. Native integration checks cover available-metadata provenance, build-local regeneration certificates, fmt modules and TinyCC bootstrap. The default GCC and Clang case harnesses build the ordinary libraries, staged consumers, nanobind for both Python interpreters, Qt, Bazel flatc, HelloWasm and both Android ABIs. The full GCC Halide build succeeds; its 877 tests report 783 passes, 92 skips and two failures. This harness selects the native Linux configuration without the Python-binding configuration used in the 941-distinct-test macOS fidelity study; the totals are not the same test population. An isolated rerun passes mullapudi2016_mat_mul. performance_fast_inverse still fails its timing inequality, also in three executions linked against the image’s independently CMake-built Halide. This is a platform performance assertion, not evidence of equal test outcomes on every run.

54

Alex Reinking

In the CUDA 13.4.2 image, stdgpu builds and links; its 17 compile commands match CMake’s, with the documented runtime-library link differences. Toolkit tests give five passes with real nvcc and 29 with a fake toolkit (two skips). No GPU runtime is available. Commands, outcomes and limitations are recorded in notes/data/single-composition/validation.json. C.9 Pins An ambiguous choice is an error that a pin resolves, so the pins a study needs depend on the machine. We repeated the pin experiment of §6.2 in the Linux image (§C.8), removing each of the 34 pin rows of the Linux user files of every study but Qt’s in turn. With only GCC offered, the default there, one row is needed: libHalide’s LLVM linkage. With GCC and Clang both offered, 21 are: one toolchain pin per language a study compiles plus one for the linker, 0 to 4 per study; without its pins a study reports from 0 (nlohmann/json, which compiles nothing) to 859 (libHalide) ambiguity errors. A single user-global file of three rows (C, C++ and the linker driver, all GCC) removes every toolchain ambiguity in these studies, so those rows are per-machine policy, not repeated project decisions. The separate LLVM-linkage pin remains. C.10

End-to-End Configure Comparison

This comparison asks whether the prototype’s architecture permits practical configuration costs, not whether it outperforms mature systems. notes/data/author-revision/configuration retains 660 successful samples, commands, environment, scope checks and source hashes; the exact measured harness is notes/data/author-revision/configure-all.measured.py. The Halide row is replaced by 60 new paired samples after native interpreter inheritance, retained separately in notes/data/halide-inherit/configuration, using the same harness and method. After restoring Qt 6.11.3, a further 60 paired samples in notes/data/qt-refresh/configuration supply its missing row. The published selection thus has 720 samples: ten serial trials of eleven paired configurations and the two SDK apps on the buildlog side only. These datasets are not pooled. Runs use the machine and native tools of §6.1, Python 3.14.0 and the patched Soufflé binary. Tool order alternates by trial, study and mode. The harness waits before each study block for load below 3.5 and no running Docker containers; load can rise within a block (observed range 2.26–9.17). The replacement Halide samples range from 3.11 to 6.58. The Qt samples range from 2.95 to 4.33. We run no concurrent test or build jobs. Each study has private project/source copies, build directories and buildlog caches. The timer brackets the unprofiled subprocess, including startup, compiler probes and graph generation, but excludes copying, edits, result processing, builds and tests. Cold empties tool state, not OS filesystem caches. Warm explicitly invokes configure unchanged. Meson uses setup --reconfigure; Bazel uses build --nobuild against its live server, with a fresh server/output root cold. Bazel’s networked dependency prefetch is untimed; timed commands have networking disabled. Edit adds one private definition to corresponding targets (an interface definition for header-only nlohmann/json). Emitted files verify the edit; an untimed Bazel aquery checks its actual compile arguments. Each cell of Table 3 gives the arithmetic mean and relative √ two-sided 95% Student-𝑡 confidence ¯ percent. These intervals describe half-width, with nine degrees of freedom: 100 𝑡 0.975,9𝑠/( 10 𝑥) repeat variability on this machine, not uncertainty across machines or workloads. No medians, observed ranges or API-only measurements are mixed into these intervals. Scopes. All rows use the native release configuration (Bazel’s opt). zlib is shared-only. zlib-ng includes both library variants and the ported C tests; the additional upstream GTest suite is disabled. Halide includes Python bindings, tutorials, utils, autoschedulers and tests on both sides, with the nine port exclusions described above. Its Python binding dependencies match the refreshed

Meta Build Systems as Logic Programs

55

Table S13. Configure API times, seconds: median (minimum–maximum), five samples per cell. Project

Cold

Warm

Edit

Trivial zlib Halide

1.903 (1.865–1.971) 2.274 (2.224–2.303) 5.987 (5.884–6.307)

.035 (.034–.036) .050 (.049–.054) .292 (.289–.307)

.611 (.597–.630) .783 (.772–.809) 3.567 (3.541–3.767)

native validation. Nanobind covers Python 3.13/abi3 and Python 3.11 in one buildlog invocation; the upstream sample sums two direct CMake configures, excluding scikit-build-core and wheel packaging. For ggml, CMake configures additional tests/examples beyond the two ported programs. SPIRV-Tools’ port uses installed GoogleTest for four tests, while the upstream source copy lacks its GoogleTest checkout and configures without tests. The Qt row selects native release on both sides, using the same Qt 6.11.3 SDK; debug, x86_64 and universal2 validation are outside its timed scope. Thus the rows share source pins and product/toolchain modes, not identical graphs. The command logs and compiler inventories record these boundaries. SDK apps. HelloWasm’s buildlog cold/warm/edit means are 7.11±5.4%, 0.89±2.3% and 3.76±3.4% seconds. HelloAndroid’s are 3.11±3.8%, 0.13±3.1% and 0.91±3.0%. We do not time the CMake outer shells as comparators: HelloWasm defers its sub-configures until build time, while HelloAndroid compiles its host generators inside configure. Neither does the same work as buildlog’s graph derivation. The prototype retains fixed startup cost and workload-dependent overhead, but configures these builds in seconds. This is feasibility evidence, not parity, superiority or graph equivalence. The earlier five-trial, three-project CLI dataset remains separately archived in notes/data/configure-comparison; it is not pooled with these runs. C.11

Instrumented Configure API Measurements

notes/data/single-composition retains the raw records, source hashes and medians. We report its 45 implementation samples: five repetitions of three projects in three modes. Runs use Python 3.14.0, Soufflé 12912a9dd, the native tools of §6.1 and common source dependencies. Each repetition visits trivial, zlib and Halide; each project gets a private copy, build directory and initially empty composition/probe cache. Cold updates only that copy’s lock; warm repeats unchanged; edit adds a real compile definition. These Halide API runs omit the Python preset and are unaffected by its native configuration-sharing override. No tests or container builds run concurrently; observed one-minute load is 3.4–5.3. The timer brackets configure_project, excluding interpreter startup and result capture. Every mode succeeds. Consequently these are not whole-process command-line times and do not establish a timing comparison against CMake, Meson or Bazel. Independent wrappers count actual composition calls, evaluator starts and evaluations. All three projects perform 1/1/4 operations cold and 1/1/1 after edit in every repetition; every warm run performs 0/0/0. An untimed-for-comparison profile attributes .554 of .704 profiled seconds to four certificate validations (content, directory membership, absence and ancestor symlinks). Profiling overhead means these seconds are not another timing sample. We leave the validation checks intact.

56

C.12

Alex Reinking

A Standard From the Lattice Join

The cross-compilation example’s app depends privately on util, which states C++20 publicly and depends publicly on core, which states C++17. app states no standard. Here is the full answer excerpted in §6.3, for app’s -std=c++20 (x86_64 release, run from the example’s parent directory): $ buildlog why -C build --flag -std=c++20 --output obj/x86_64-macos.release.none/app/app/main.cpp.o cross action_arg("out:obj/x86_64-macos.release.none/app/app/main.cpp.o", 10, "-std=c++", "20") [cpp:L4_cxx.dl:33] cxx_object("app", <x86>, "app/main.cpp", "out:obj/x86_64-macos.release.none/app/app/main.cpp.o") [cpp:L4_cxx. dl:23] ^ #n51 src_on("app", <x86>, "app/main.cpp") [cpp:L4_cxx.dl:210] #n3 needed("app", <x86>) [exists here because it is built in this configuration; --demand explains why] #n51 cxx_source("app", "app/main.cpp") ← cross/spec.toml:25 !src_grouped("app", "app/main.cpp") use_join("app", <x86>, "cxx.std", "20") [L1:760] use_cand("app", <x86>, "cxx.std", "20", 1) [L1:742] eff_dep("app", <x86>, "util", "private") [L1:596] eff_ref("app", <x86>, "util", "private") [L1:594] ^ #n3 #n74 dep("app", "util", "private") ← cross/spec.toml:34 own_ref("app", "util", "util") [L1:706] (via dep_resolves) ^ #n74 (via dep_ref) !scoped("app") target("util") ← cross/spec.toml:88 (via target_id) !scoped("util") eff_prop("util", <x86>, "cxx.std", "20", "public") [L1:718] (via iface) needed("util", <x86>) [exists here because it is built in this configuration; --demand explains why] prop("util", "cxx.std", "20", "public") ← cross/spec.toml:70 lattice_key("cxx.std") [L1:748]

Here <x86> is the record ["x86_64-macos", [["native.opt", "release"], [["native.sanitize", "none"], [["native.linkage", "default"], nil]]]]. The maximum itself is a leaf: --full adds the constraint 20 = 20 under use_join, and no view lists the candidates that lost. The join’s first premise binds the value, so the candidate printed is always one that carries the winning value. In a variant where app also states C++17 privately (one added row, spec line 71), the flag is still -std=c++20, and the leaf listing still cites util’s line 70, not app’s C++17 line; a regression test checks this. The losing candidates are one query away: $ buildlog query -C build-variant 'use_cand("app", c, "cxx.std", v, r)' cross c v r <x86> 17 0 <x86> 17 1 <x86> 20 1

# x86_64 rows

Rank 0 is the target’s own value and rank 1 an inherited one. C.13

An Ambiguous Package

buildlog’s package search finds every candidate and does not rank them. A test of the importers gives a consumer two install prefixes that both hold CMake export files for Greet::shout: an installed fixture and a copy of it. Configure stops before building anything. With the two prefixes written as <copy> and <prefix> (sorted, as the error lists them), the output is: error: ambiguous package: Greet::shout on arm64-macos: <copy>/lib/cmake/Greet/Greet-targets.cmake and <prefix>/ lib/cmake/Greet/Greet-targets.cmake both provide it; add a package_pin error: unresolved dependency: dependency Greet::shout of hello has no definition

The error is the same whichever order the prefixes are listed in. One line in a user file resolves it: package_pin = [["Greet::shout", "<copy>/lib/cmake/Greet/Greet-targets.cmake"]]

Meta Build Systems as Logic Programs

57

The build then links the copy’s library. Given the same two prefixes in CMAKE_PREFIX_PATH, CMake’s find_package takes the package file under the first prefix and says nothing [32]. Reversing the order of the prefixes silently changes which library is linked. References [1] Pietro Abate, Roberto Di Cosmo, Georgios Gousios, and Stefano Zacchiroli. 2020. Dependency Solving Is Still Hard, but We Are Getting Better at It. In 2020 IEEE 27th International Conference on Software Analysis, Evolution and Reengineering (SANER). IEEE, London, ON, Canada, 547–551. doi:10.1109/SANER48275.2020.9054837 [2] Krzysztof R. Apt, Howard A. Blair, and Adrian Walker. 1988. Towards a Theory of Declarative Knowledge. In Foundations of Deductive Databases and Logic Programming, Jack Minker (Ed.). Morgan Kaufmann, 89–148. doi:10.1016/B978-0934613-40-8.50006-3 [3] Michael Arntzenius and Neelakantan R. Krishnaswami. 2016. Datafun: A Functional Datalog. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016). ACM, Nara, Japan, 214–227. doi:10.1145/2951913.2951948 [4] Pavel Avgustinov, Oege de Moor, Michael Peyton Jones, and Max Schäfer. 2016. QL: Object-oriented Queries on Relational Data. In 30th European Conference on Object-Oriented Programming (ECOOP 2016) (Leibniz International Proceedings in Informatics (LIPIcs), Vol. 56). Schloss Dagstuhl–Leibniz-Zentrum für Informatik, Dagstuhl, Germany, 2:1–2:25. doi:10.4230/LIPIcs.ECOOP.2016.2 [5] François Bancilhon, David Maier, Yehoshua Sagiv, and Jeffrey D. Ullman. 1986. Magic Sets and Other Strange Ways to Implement Logic Programs (Extended Abstract). In Proceedings of the Fifth ACM SIGACT-SIGMOD Symposium on Principles of Database Systems (PODS ’86). ACM, Cambridge, MA, USA, 1–15. doi:10.1145/6012.15399 [6] Martin Bravenboer and Yannis Smaragdakis. 2009. Strictly Declarative Specification of Sophisticated Points-to Analyses. In Proceedings of the 24th ACM SIGPLAN Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA ’09). ACM, Orlando, FL, USA, 243–262. doi:10.1145/1640089.1640108 [7] Francesco Calimeri, Susanna Cozza, and Giovambattista Ianni. 2007. External Sources of Knowledge and Value Invention in Logic Programming. Annals of Mathematics and Artificial Intelligence 50, 3–4 (2007), 333–361. doi:10.1007/s10472007-9060-7 [8] Adriane Chapman and H. V. Jagadish. 2009. Why Not?. In Proceedings of the 2009 ACM SIGMOD International Conference on Management of Data (SIGMOD ’09). ACM, Providence, RI, USA, 523–534. doi:10.1145/1559845.1559901 [9] Ludovic Courtès. 2013. Functional Package Management with Guix. European Lisp Symposium (ELS 2013), Madrid, Spain. arXiv:1305.4584 https://arxiv.org/abs/1305.4584 [10] Alexandru Croitor. 2019. Allow a function to be called when a target is “closed” / “finalized”. CMake issue #19575, https://gitlab.kitware.com/cmake/cmake/-/issues/19575. Closed by merge request !5262 (cmake_language(DEFER)), 2020. Accessed 2026-09-30. [11] Eelco Dolstra, Eelco Visser, and Merijn de Jonge. 2004. Imposing a Memory Management Discipline on Software Deployment. In Proceedings of the 26th International Conference on Software Engineering (ICSE 2004). IEEE Computer Society, Edinburgh, UK, 583–592. doi:10.1109/ICSE.2004.1317480 [12] Thomas Eiter, Giovambattista Ianni, Roman Schindlauer, and Hans Tompits. 2005. A Uniform Integration of HigherOrder Reasoning and External Evaluations in Answer-Set Programming. In Proceedings of the Nineteenth International Joint Conference on Artificial Intelligence (IJCAI-05). Edinburgh, Scotland, UK, 90–96. [13] Sebastian Erdweg, Moritz Lichter, and Manuel Weiel. 2015. A Sound and Optimal Incremental Build System with Dynamic Dependencies. In Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA 2015). ACM, Pittsburgh, PA, USA, 89–106. doi:10.1145/2814270.2814316 [14] Hamed Esfahani, Jonas Fietz, Qi Ke, Alexei Kolomiets, Erica Lan, Erik Mavrinac, Wolfram Schulte, Newton Sanches, and Srikanth Kandula. 2016. CloudBuild: Microsoft’s Distributed and Caching Build Service. In Proceedings of the 38th International Conference on Software Engineering Companion (ICSE ’16 Companion). ACM, Austin, TX, USA, 11–20. doi:10.1145/2889160.2889222 [15] Fedora Project. 2026. Fedora Packaging Guidelines. https://docs.fedoraproject.org/en-US/packaging-guidelines/. Accessed 2026-10-10. [16] Todd Gamblin, Massimiliano Culpo, Gregory Becker, and Sergei Shudler. 2022. Using Answer Set Programming for HPC Dependency Solving. In SC22: International Conference for High Performance Computing, Networking, Storage and Analysis. IEEE, Dallas, TX, USA, 1–15. doi:10.1109/SC41404.2022.00040 [17] Todd Gamblin, Matthew LeGendre, Michael R. Collette, Gregory L. Lee, Adam Moody, Bronis R. de Supinski, and Scott Futral. 2015. The Spack Package Manager: Bringing Order to HPC Software Chaos. In Proceedings of the International Conference for High Performance Computing, Networking, Storage and Analysis (SC ’15). ACM, Austin, TX, USA, 1–12. doi:10.1145/2807591.2807623

58

Alex Reinking

[18] Martin Gebser, Roland Kaminski, Benjamin Kaufmann, and Torsten Schaub. 2019. Multi-shot ASP Solving with clingo. Theory and Practice of Logic Programming 19, 1 (2019), 27–82. doi:10.1017/S1471068418000054 [19] Gentoo Quality Assurance Project. 2026. Project:Quality Assurance/User vs upstream FLAGS. https://wiki.gentoo.org/ wiki/Project:Quality_Assurance/User_vs_upstream_FLAGS. Gentoo Wiki. Accessed 2026-10-10. [20] Milos Gligoric, Wolfram Schulte, Chandra Prasad, Danny van Velzen, Iman Narasamdya, and Benjamin Livshits. 2014. Automated Migration of Build Scripts Using Dynamic Analysis and Search-Based Refactoring. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’14). ACM, Portland, OR, USA, 599–616. doi:10.1145/2660193.2660239 [21] Gradle Inc. 2026. Configuration Cache. https://docs.gradle.org/current/userguide/configuration_cache.html. Gradle 9.8.1; accessed 2026-10-15. [22] Gradle Inc. 2026. Configuring Tasks Lazily. https://docs.gradle.org/current/userguide/lazy_configuration.html. Gradle 9.8.1; accessed 2026-10-15. [23] Todd J. Green, Grigoris Karvounarakis, and Val Tannen. 2007. Provenance Semirings. In Proceedings of the Twenty-Sixth ACM SIGMOD-SIGACT-SIGART Symposium on Principles of Database Systems (PODS ’07). ACM, Beijing, China, 31–40. doi:10.1145/1265530.1265535 [24] Halide contributors. 2026. Halide, cmake/HalideGeneratorHelpers.cmake, lines 378–452. https://github.com/halide/ Halide/blob/4e272cbfcc35a107ca11b8839a06ebae2b36221f/cmake/HalideGeneratorHelpers.cmake. Commit 4e272cbfc. [25] Haotian Han, Zihang Zhong, Qingan Li, Jingling Xue, and Mengting Yuan. 2026. CMakeSonar: A Static Approach to Detecting CMake Bugs with a Fine-Grained Type System. Proc. ACM Program. Lang. 10, OOPSLA1 (2026), 513–539. doi:10.1145/3798218 [26] Ian H. Holmes and Christopher J. Mungall. 2017. BioMake: a GNU make-compatible utility for declarative workflow management. Bioinformatics 33, 21 (2017), 3502–3504. doi:10.1093/bioinformatics/btx306 [27] Herbert Jordan, Bernhard Scholz, and Pavle Subotić. 2016. Soufflé: On Synthesis of Program Analyzers. In Computer Aided Verification (CAV 2016) (Lecture Notes in Computer Science). Springer, Cham, Switzerland, 422–430. doi:10.1007/9783-319-41540-6_23 [28] Kitware. 2026. add_library. https://cmake.org/cmake/help/latest/command/add_library.html. Accessed 2026-10-14. [29] Kitware. 2026. cmake-buildsystem(7): CMake Buildsystem Reference. https://cmake.org/cmake/help/latest/manual/ cmake-buildsystem.7.html. Accessed 2026-09-30. [30] Kitware. 2026. cmake-generator-expressions(7). https://cmake.org/cmake/help/latest/manual/cmake-generatorexpressions.7.html. Accessed 2026-09-30. [31] Kitware. 2026. COMPATIBLE_INTERFACE_STRING Target Property. https://cmake.org/cmake/help/latest/prop_tgt/ COMPATIBLE_INTERFACE_STRING.html. Accessed 2026-09-30. [32] Kitware. 2026. find_package. https://cmake.org/cmake/help/latest/command/find_package.html. Accessed 2026-10-02. [33] Kitware. 2026. IMPORTED_LOCATION. https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LOCATION.html. Accessed 2026-10-14. [34] LASzip contributors. 2025. LASzip 3.5.0, CMakeLists.txt, lines 9–13. https://github.com/LASzip/LASzip/blob/3.5.0/ CMakeLists.txt. Tag 3.5.0, commit fa089bd. [35] Chris Lattner, Mehdi Amini, Uday Bondhugula, Albert Cohen, Andy Davis, Jacques Pienaar, River Riddle, Tatiana Shpeisman, Nicolas Vasilache, and Oleksandr Zinenko. 2021. MLIR: Scaling Compiler Infrastructure for Domain Specific Computation. In 2021 IEEE/ACM International Symposium on Code Generation and Optimization (CGO). IEEE, Seoul, Korea, 2–14. doi:10.1109/CGO51591.2021.9370308 [36] Seokki Lee, Bertram Ludäscher, and Boris Glavic. 2019. PUG: A Framework and Practical Implementation for Why and Why-Not Provenance. The VLDB Journal 28, 1 (2019), 47–71. doi:10.1007/s00778-018-0518-5 [37] Nandor Licker and Andrew Rice. 2019. Detecting Incorrect Build Rules. In Proceedings of the 41st International Conference on Software Engineering (ICSE 2019). IEEE, Montreal, QC, Canada, 1234–1244. doi:10.1109/ICSE.2019.00125 [38] Magnus Madsen, Ming-Ho Yee, and Ondřej Lhoták. 2016. From Datalog to Flix: A Declarative Language for Fixed Points on Lattices. In Proceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’16). ACM, Santa Barbara, CA, USA, 194–208. doi:10.1145/2908080.2908096 [39] Fabio Mancinelli, Jaap Boender, Roberto Di Cosmo, Jérôme Vouillon, Berke Durak, Xavier Leroy, and Ralf Treinen. 2006. Managing the Complexity of Large Free and Open Source Package-Based Software Distributions. In 21st IEEE/ACM International Conference on Automated Software Engineering (ASE ’06). IEEE, Tokyo, Japan, 199–208. doi:10.1109/ASE. 2006.49 [40] Evan Martin. 2013. Ninja. In The Performance of Open Source Applications, Tavish Armstrong (Ed.). https://aosabook. org/en/posa/ninja.html [41] Shane McIntosh, Bram Adams, and Ahmed E. Hassan. 2012. The Evolution of Java Build Systems. Empirical Software Engineering 17, 4–5 (2012), 578–608. doi:10.1007/s10664-011-9169-5

Meta Build Systems as Logic Programs

59

[42] Shane McIntosh, Bram Adams, Thanh H. D. Nguyen, Yasutaka Kamei, and Ahmed E. Hassan. 2011. An Empirical Study of Build Maintenance Effort. In Proceedings of the 33rd International Conference on Software Engineering (ICSE ’11). ACM, Honolulu, HI, USA, 141–150. doi:10.1145/1985793.1985813 [43] Shane McIntosh, Meiyappan Nagappan, Bram Adams, Audris Mockus, and Ahmed E. Hassan. 2015. A Large-Scale Empirical Study of the Relationship between Build Technology and Build Maintenance. Empirical Software Engineering 20, 6 (2015), 1587–1633. doi:10.1007/s10664-014-9324-x [44] Microsoft. 2026. vcpkg Maintainer Guide. https://learn.microsoft.com/en-us/vcpkg/contributing/maintainer-guide. Build techniques. Accessed 2026-11-10. [45] Neil Mitchell. 2012. Shake Before Building: Replacing Make with Haskell. In Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming (ICFP ’12). ACM, Copenhagen, Denmark, 55–66. doi:10.1145/ 2364527.2364538 [46] Neil Mitchell. 2026. Development.Shake: addOracle. https://hackage.haskell.org/package/shake/docs/DevelopmentShake.html. Shake 0.19.9 API documentation. Accessed 2026-10-13. [47] Andrey Mokhov, Neil Mitchell, and Simon Peyton Jones. 2018. Build Systems à la Carte. Proc. ACM Program. Lang. 2, ICFP (2018), 1–29. doi:10.1145/3236774 [48] Andrey Mokhov, Neil Mitchell, and Simon Peyton Jones. 2020. Build Systems à la Carte: Theory and Practice. Journal of Functional Programming 30 (2020), e11. doi:10.1017/S0956796820000088 [49] Mahtab Nejati, Mahmoud Alfadel, and Shane McIntosh. 2024. Understanding the Implications of Changes to Build Systems. In Proceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering (ASE). ACM, New York, NY, USA, 1421–1433. doi:10.1145/3691620.3695514 [50] Alexander Neundorf. 2011. Cool new stuff in CMake 2.8.6: automoc. KDE Blogs, https://blogs.kde.org/2011/11/01/coolnew-stuff-cmake-286-automoc/. Accessed 2026-09-30. [51] KimHao Nguyen, ThanhVu Nguyen, and Quoc-Sang Phan. 2022. Analyzing the CMake Build System. In Proceedings of the 44th International Conference on Software Engineering: Software Engineering in Practice (ICSE-SEIP). ACM, New York, NY, USA, 27–28. doi:10.1145/3510457.3513064 [52] Pants Build. 2026. C/C++ Backend Target Types (src/python/pants/backend/cc/target_types.py), Pants 2.33.1. https://github.com/pantsbuild/pants/blob/release_2.33.1/src/python/pants/backend/cc/target_types.py. Tag release_2.33.1. Accessed 2026-10-02. [53] Pants Build. 2026. Internal Architecture. https://www.pantsbuild.org/stable/docs/contributions/development/internalarchitecture. Accessed 2026-09-30. [54] Donald Pinckney, Federico Cassano, Arjun Guha, Jonathan Bell, Massimiliano Culpo, and Todd Gamblin. 2023. Flexible and Optimal Dependency Management via Max-SMT. In 2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE). IEEE, Melbourne, Australia, 1418–1429. doi:10.1109/ICSE48619.2023.00124 [55] Jonathan Ragan-Kelley, Connelly Barnes, Andrew Adams, Sylvain Paris, Frédo Durand, and Saman Amarasinghe. 2013. Halide: A Language and Compiler for Optimizing Parallelism, Locality, and Recomputation in Image Processing Pipelines. In Proceedings of the 34th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’13). ACM, Seattle, WA, USA, 519–530. doi:10.1145/2491956.2462176 [56] Robert Schumacher. 2019. How to Herd 1,000 Libraries. https://www.youtube.com/watch?v=Lb3hlLlHTrs. CppCon 2019. Accessed 2026-11-10. [57] Sarah Spall, Neil Mitchell, and Sam Tobin-Hochstadt. 2020. Build Scripts with Perfect Dependencies. Proc. ACM Program. Lang. 4, OOPSLA (2020), 1–28. doi:10.1145/3428237 [58] Sarah Spall, Neil Mitchell, and Sam Tobin-Hochstadt. 2022. Forward Build Systems, Formally. In Proceedings of the 11th ACM SIGPLAN International Conference on Certified Programs and Proofs (CPP ’22). ACM, Philadelphia, PA, USA, 130–142. doi:10.1145/3497775.3503687 [59] Tamás Szabó, Gábor Bergmann, Sebastian Erdweg, and Markus Voelter. 2018. Incrementalizing Lattice-Based Program Analyses in Datalog. Proc. ACM Program. Lang. 2, OOPSLA (2018), 1–29. doi:10.1145/3276509 [60] Ahmed Tamrawi, Hoan Anh Nguyen, Hung Viet Nguyen, and Tien N. Nguyen. 2012. Build Code Analysis with Symbolic Evaluation. In Proceedings of the 34th International Conference on Software Engineering (ICSE 2012). IEEE, Zurich, Switzerland, 650–660. doi:10.1109/ICSE.2012.6227152 [61] The Bazel Authors. 2026. Action Graph Query (aquery). https://bazel.build/query/aquery. Accessed 2026-10-02. [62] The Bazel Authors. 2026. CcInfo. https://bazel.build/rules/lib/providers/CcInfo. Accessed 2026-10-02. [63] The Bazel Authors. 2026. Configurations. https://bazel.build/extending/config. Accessed 2026-10-02. [64] The Bazel Authors. 2026. Module Extensions. https://bazel.build/external/extension. Accessed 2026-10-13. [65] The Bazel Authors. 2026. Repository Rules. https://bazel.build/external/repo. Accessed 2026-10-13. [66] The Bazel Authors. 2026. Skyframe. https://bazel.build/reference/skyframe. Accessed 2026-10-02. [67] The Bazel Authors. 2026. Toolchains. https://bazel.build/extending/toolchains. Accessed 2026-09-30.

60

Alex Reinking

[68] The Buck2 Authors. 2026. Configurations for Rule Authors. https://buck2.build/docs/rule_authors/configurations/. Accessed 2026-10-02. [69] The Buck2 Authors. 2026. Introduction to Modern DICE. https://buck2.build/docs/insights_and_knowledge/modern_ dice/. Accessed 2026-10-02. [70] The Buck2 Authors. 2026. Transitive Sets. https://buck2.build/docs/rule_authors/transitive_sets/. Accessed 2026-10-02. [71] The CPS Authors. 2026. Common Package Specification. https://cps-org.github.io/cps/. Accessed 2026-09-30. [72] The FreeBSD Documentation Project. 2026. FreeBSD Porter’s Handbook. https://docs.freebsd.org/en/books/portershandbook/book/. Accessed 2026-10-10. [73] The GN Authors. 2026. GN Reference. https://gn.googlesource.com/gn/+/main/docs/reference.md. Accessed 2026-1001. [74] The Meson Development Team. 2026. Cross Compilation. https://mesonbuild.com/Cross-compilation.html. Accessed 2026-09-30. [75] The Meson Development Team. 2026. Dependencies. https://mesonbuild.com/Dependencies.html. Accessed 2026-10-14. [76] The Meson Development Team. 2026. Frequently Asked Questions: Why doesn’t meson have user defined functions/macros? https://mesonbuild.com/FAQ.html. Accessed 2026-09-30. [77] The Meson Development Team. 2026. Modules. https://mesonbuild.com/Modules.html. Accessed 2026-10-14. [78] The Nix Contributors. 2026. Configuration file: pure-eval. https://nix.dev/manual/nix/2.28/command-ref/conffile.html. Nix 2.28 Reference Manual. Accessed 2026-10-13. [79] The Nix Contributors. 2026. Import From Derivation. https://nix.dev/manual/nix/2.28/language/import-fromderivation. Nix 2.28 Reference Manual. Accessed 2026-10-13. [80] The Qt Company. 2026. Module (Qbs language item). https://qbs.io/docs/qml-qbslanguageitems-module/. Accessed 2026-09-30. [81] The Qt Company. 2026. Probe (Qbs language item). https://qbs.io/docs/qml-qbslanguageitems-probe/. Accessed 2026-10-02. [82] The Qt Company. 2026. qt_add_executable: Finalization. https://doc.qt.io/qt-6/qt-add-executable.html. Qt 6.12 documentation. Accessed 2026-09-30. [83] The Qt Company. 2026. Qt.core (Qbs module). https://qbs.io/docs/qml-qbsmodules-qt-core/. Accessed 2026-10-02. [84] Moshe Y. Vardi. 1982. The Complexity of Relational Query Languages (Extended Abstract). In Proceedings of the Fourteenth Annual ACM Symposium on Theory of Computing (STOC ’82). ACM, San Francisco, CA, USA, 137–146. doi:10.1145/800070.802186 [85] John Whaley and Monica S. Lam. 2004. Cloning-Based Context-Sensitive Pointer Alias Analysis Using Binary Decision Diagrams. ACM SIGPLAN Notices 39, 6 (2004), 131–144. doi:10.1145/996893.996859 Proceedings of PLDI 2004. [86] David Zhao, Pavle Subotić, and Bernhard Scholz. 2020. Debugging Large-scale Datalog: A Scalable Provenance Evaluation Strategy. ACM Transactions on Programming Languages and Systems 42, 2 (2020), 1–35. doi:10.1145/3379446 [87] zlib contributors. 2026. zlib 1.3.2, CMakeLists.txt, lines 170 and 215. https://github.com/madler/zlib/blob/v1.3.2/ CMakeLists.txt. Tag v1.3.2, commit da607da.

Related documents

Record · ID 1672151 · SHA-256 fa26ea024628f2df
Retrieved via Conceptio: every document is proof-bundled with source, license, and retrieval metadata.
Bring this data into your agent: Connect via MCP or API · 20 free credits to start · no card required
Read the Docs → · View CLI source on GitHub · Conceptio Open Knowledge Archive