Description
I have a project that uses procedural macros from the wit-bindgen-rust
and wit-bindgen-wasmtime
to generate my WebAssembly glue code.
The project layout looks somewhat like this:
- /
- Cargo.toml (workspace root)
- wit-files/ (git submodule)
- rune
- runtime-v1.wit
- rune
- xtask/
- Cargo.toml
- src/
- lib.rs
- metadata.rs (uses
wit_bindgen_wasmtime::export!()
and friends)
At the moment I'm seeing errors where I can successfully build my xtask
crate from either the xtask/
directory or the workspace root on my desktop. However, when I am running the same code in CI, it errors out with the following:
error: failed to read: wit-files/rune/runtime-v1.wit
Error: --> /home/runner/work/proc-blocks/proc-blocks/xtask/src/metadata.rs:10:1
|
10 | wit_bindgen_wasmtime::export!("wit-files/rune/runtime-v1.wit");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I've added a dummy ls
step to verify that wit-files/rune/runtime-v1.wit
is present at that location relative to the checkout folder, but I suspect CI is running cargo build
from a different directory and therefore we get different results when we call Interface::parse_file()
with the string that was passed to the macro.
What confuses me is that I've run cargo build
fro different directories (e.g. the workspace root - /
, the xtask/
directory, and /xtask/src/
) and it all works as intended on my computer.
Do you have any troubleshooting suggestions or an explanation of what is going on?
$ rustc --version --verbose
rustc 1.60.0-nightly (bfe156467 2022-01-22)
binary: rustc
commit-hash: bfe15646761a75f0259e204cab071565eed2b1e5
commit-date: 2022-01-22
host: x86_64-unknown-linux-gnu
release: 1.60.0-nightly
LLVM version: 13.0.0
My Cargo.lock
says I am currently using e9c7c0a from the wit-bindgen
repo. My code is accessible via hotg-ai/proc-blocks@51ad84e and I was seeing the error on cargo xtask dist
.