Skip to content

Tooling: link [native] package sources on flow run, gate proof doc drift, build benchmarks on macOS - #1085

Merged
godofecht merged 3 commits into
mainfrom
fix/tooling-issues
Sep 30, 2026
Merged

godofecht merged 3 commits into
mainfrom
fix/tooling-issues

Conversation

@godofecht

Copy link
Copy Markdown
Contributor

Three tooling fixes, one commit each. Each comes with a check that fails before the change and passes after.

#991: flow run builds and links [native] package sources

The package manager has a new command, native-link, in compiler/src/pkg.flow and pkg_main.flow. It finds the program's project and collects the [native] sources, cflags, frameworks, libs and ldflags of the installed dependencies and of the project itself. This is the same set that build-native and the old package.py used. Each source compiles into build/flow_native/<stem>-<key>.o. The key covers the compiler, the flags, the path and the source contents, so an unchanged source is compiled only once. C++ sources go to the C++ compiler and add the C++ library to the link.

flowc_link_c in flow-driver calls the command only when a flow.toml in the project or in flow_packages/ declares [native]. It links the objects and flags ahead of the runtime archive.

scripts/check_run_without_python.sh now runs fresh copies of examples/ecosystem/sqlite_demo and app_cache with python stubbed out. It runs sqlite_demo twice to check the object cache.

  • Before: 4 failures, Undefined symbols: _flow_sqlite_*.
  • After: 31/31 pass, python stubs called 0 times.

#1011: six stale proof documents regenerated, drift is now a gate

./flow doc proof <file> regenerated full_adder, ring_buffer_fifo and matmul_vectorize. The diff matches what the current renderer writes:

  • numbering restarts at 1 per file
  • every binder is quantified
  • multi-word names render as \text{...}
  • steps are cited as "step N"
  • the Ripple4 theorem is gone, because the source no longer has it

compiler/scripts/parity_proofs.sh used to only report the document count. It now fails on any checked-in document that differs from what flowc writes, and names the file and the command that regenerates it.

  • Before: 2102/2108, FAIL (6).
  • After: 2108/2108, PASS.

#964: the published benchmarks build on macOS

The C and Flow benchmark programs now share one static helper, bench_now_ns, built on clock_gettime(CLOCK_MONOTONIC). Linux and macOS both have it under _POSIX_C_SOURCE.

The new scripts/check_bench_publish.sh builds each benchmark in C and in Flow with implicit declarations treated as errors, runs both, and compares their results.

  • Before on macOS: 5/5 fail.
  • After: 5/5 pass.

benchmarks/run_publish.sh --quick runs end to end on macOS, and all results agree across C, Flow, Python and Rust.

Gates (macOS)

These pass: bootstrap_from_c.sh --verify, self_host_full.sh, roundtrip.sh, parse_coverage.sh --check, fmt_check.sh --check, tests/cgen/run.sh, flow test-lang, corpus_parity.sh --check, parity_typecheck.sh --check, typecheck_rules.sh, parity_{dap,dynamics_dsl,effects,field_dsl,flow_blocks,lowering,mlir,project_test,proofs,targets}.sh, python_ratchet.sh, check_pkg_commands.sh and check_pkg_parity.sh.

parity_shader_dsl.sh passes everything except the Metal e2e step, which needs the Metal Toolchain and is not installed on this machine.

The bootstrap C needs no regeneration. pkg.flow is not part of the main.flow bundle.

Fixes #991
Fixes #1011
Fixes #964

The hand-written C called clock_gettime_nsec_np on Apple, which
_POSIX_C_SOURCE hides, so none of benchmarks/publish/c built on macOS.
Both the C and the Flow programs now use one static helper,
bench_now_ns, built on the POSIX clock that Linux and macOS share.

scripts/check_bench_publish.sh builds each benchmark in C and in Flow
with implicit declarations as errors, runs them and compares results.
It fails on all five before this change on macOS and passes after.
run_publish.sh --quick now runs end to end on macOS.

Fixes #964
full_adder, ring_buffer_fifo and matmul_vectorize had .proof.md and
.proof.tex that no generator reproduces (hand edits, an older renderer,
and a Ripple4 theorem the source no longer has). They are now what
`./flow doc proof <file>` writes. The diff is the current renderer's
output: numbering restarts at 1 per file, every binder is quantified,
multi-word names render as \text{...}, and steps cite "step N".

parity_proofs.sh compared the checked-in documents but only reported
the count. A document that differs from what flowc writes is now a
failure that names the file and the command that regenerates it.
Before: 2102/2108, FAIL (6). After: 2108/2108, PASS.

The Graphviz kernel plot (item 2) is a note and needs no change.

Fixes #1011
`flow run` and `flow compile` on the flowc host linked only the Flow C
and the runtime archive, so programs using registry packages with
[native] C sources (sqlite, http, compress, ...) failed to link.

The package manager has a new `native-link` command. It finds the
program's project, collects the [native] sources, cflags, frameworks,
libs and ldflags of the installed dependencies and of the project, the
same set build-native uses, and compiles each source into
build/flow_native/<stem>-<key>.o. The key covers the compiler, flags,
path and source contents, so an unchanged source is compiled once.
C++ sources go to the C++ compiler and add the C++ library to the link.
flowc_link_c asks for these objects and flags when a flow.toml in the
project or in flow_packages/ declares [native], and links them ahead of
the runtime archive.

check_run_without_python.sh now runs examples/ecosystem sqlite_demo
and app_cache from a fresh copy with python stubbed out, runs
sqlite_demo twice to prove the object cache, and checks the output.
Before: 4 failures (undefined _flow_sqlite_*). After: 31/31 pass.

Fixes #991
@godofecht
godofecht merged commit 366baa2 into main Sep 30, 2026
31 checks passed
godofecht added a commit that referenced this pull request Sep 30, 2026
scripts/check_bench_publish.sh (from #1085) runs in the native-tools job after the shell tests. It passes on Linux in this PR's CI.
godofecht added a commit that referenced this pull request Oct 1, 2026
…-driver

flowc_link_c asks the package manager (native-link) for the objects and
flags of the project's and installed packages' [native] sources when a
flow.toml declares [native], and links them ahead of the runtime archive.
check_run_without_python.sh: 31 of 31, including sqlite_demo and
app_cache.
@godofecht
godofecht deleted the fix/tooling-issues branch October 1, 2026 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant