wit-bindgen-rt: add option to regenerate binary artifacts
wit-bindgen-rt is now (since 1.86) part of rustc's transitive dep tree, it would be great if there were an option (e.g., a feature honored by build.rs?) to regenerate the included binary artifacts that could be used as part of building rustc. distros like Debian have this as requirement for distribution.
I can try to whip something up if this seems acceptable.
I wouldn't be opposed to adding this, but I also think that implementing this is probably going to be trickier than expected. For example this won't really be tested at all so is likely to regress over time. Additionally you'll probably need to guarantee that the script to build these artifacts is all part of the wit-bindgen-rt crate which is not currently the case (and again would be un-tested).
The Rust compiler, while it transitively includes this crate, does not use this crate because the Rust compiler is not compiled to wasm. In that sense the objects could also be replaced with blank files, but I don't know the specifics of this policy and what the implications are for possible solutions.
I haven't yet tried to build 1.86 at all, this just came up while reviewing the newly vendored files. I will see if removing them works out, then it's probably simpler for the time being..
IMHO it would still be great to have a way to rebuild them included in the published crate - at the latest it would be required as soon as the wit stack including wit-bindgen-rt is packaged itself for Debian, which will probably happen at some point if WASM continues to pick up steam ;)
with rustc 1.91.1, the build of libstd for wasm targets now fails if the pre-compiled artifacts in wit-bindgen (-rt is no more ;)) are removed prior to building.. I'll once more see if I can work around this locally, but still wanted to make note of it here ;)
the dep-chain there is
std ---wasi-p2 target---> wasi 0.14 -> wit-bindgen
for 1.91.1
haven't found a way yet, seems like wit-bindgen including those files is now a hard dependency when building the stdlib for the wasi-p2 target.. if I am missing something I'd be glad to get additional pointers or hints!
at least regenerating them seems pretty straight-forward, if it works as expected I will open a PR making the script more useful in that context, maybe it would be possible to run it from build.rs if the objects are missing or a cfg/env var/.. is set..