Stream: git-wasmtime

Topic: wasmtime / PR #14144 c-api: install headers from build.rs...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2026 at 23:44):

Isekai923 opened PR #14144 from Isekai923:c-api-header-install-without-cmake to bytecodealliance:main:

Currently wasmtime-c-api-impl's build script shells out to cmake -P cmake/install-headers.cmake to produce the C API headers in OUT_DIR. cmake is only used as a scripting engine there — it substitutes the #cmakedefine lines in conf.h.in and copies the .h/.hh files — but this makes cmake a build requirement for every crate that transitively depends on wasmtime-c-api-impl, most notably anything using tree-sitter's wasm feature, even though nothing is actually compiled with cmake.

This regularly surprises downstream users because the failure only appears when the build-script fingerprint is invalidated ("it built yesterday"), and the error (failed to spawn 'cmake') doesn't look related to their code. See e.g. zed-industries/zed#18084; we hit the same thing in our project when a dev machine lost its cmake install.

What this PR does

Reimplements the header install directly in build.rs using std only (~60 lines):

The cmake scripts themselves are untouched and still used by the standalone CMake build of the C API; build.rs simply no longer invokes cmake.

Verification

view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2026 at 23:44):

Isekai923 requested pchickey for a review on PR #14144.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 16 2026 at 23:44):

Isekai923 requested wasmtime-core-reviewers for a review on PR #14144.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 17 2026 at 01:04):

github-actions[bot] added the label wasmtime:c-api on PR #14144.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 17 2026 at 17:24):

pchickey requested alexcrichton for a review on PR #14144.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 17 2026 at 17:24):

pchickey unassigned pchickey from PR #14144 c-api: install headers from build.rs without requiring cmake.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 17 2026 at 17:25):

pchickey commented on PR #14144:

I'm fine with this change in principle but I don't know why cmake was originally used here, so I'm passing this to Alex.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 17 2026 at 17:49):

alexcrichton commented on PR #14144:

Thanks for the PR, and while I've no doubt an LLM can reproduce CMake's configure_file logic the original purpose here was to avoid duplicating creation of header files across build systems. I understand the motivation to reduce dependencies, but from a maintenance perspective I'd prefer to not have two ways of doing the same thing with no comments indicating that they need to be kept in sync.

One strategy we've taken in the past for situations like this is to add extra CI checks to ensure that two systems intended to do the same thing actually do the same thing. For example there'd be some sort of CI check that the CMake-created set of header files is the same as the Rust-build-script-created set of header files. That would reduce the likelihood of divergence between the two, and while it wouldn't solve the duplication problem the duplication here is in theory not going to get all that much more complicated than it currently is.


Last updated: Aug 30 2026 at 09:07 UTC