Stream: general

Topic: Trouble setting up dev environment for wasmtime


view this post on Zulip Nam Junghyun (Nov 24 2022 at 15:18):

Hi, I'm trying to set up development environment for the wasmtime project, but struggling with some wierd rust-analyzer experiences.

Current environment: Aarch64, MacOS 13, VSCode, Rust 1.65(1.64 seems same), rust-analyzer v0.3.1293 (latest), wasmtime 42d460f3a67ef5fdcf072d30a7751c1bd975272e (main, latest)
.vscode/settings.json(suggested by bjorn3, see https://bytecodealliance.zulipchat.com/#narrow/stream/206238-general/topic/Can.20you.20share.20your.20IDE.20settings.20for.20wasmtime.3F/near/310826572):

{
    "rust-analyzer.checkOnSave.features": [
        "wasmtime/cranelift"
    ],
    "rust-analyzer.cargo.features": [
        "wasmtime/cranelift"
    ],
}

First problem: Type mismatch on src/commands/run.rs, only on rust-analyzer: expected &mut {unknown}, found &mut Linker<Host>
image.png
Seems like the define_wasi! macro defining add_to_linker is the cause, but I couldn't find any solution yet.

Second problem: rust-analyzer does nothing on wasmtime crate, except syntax checks. If I do create invalid expressions like adding i32 and Modules on crates/wasmtime/modules.rs, no complains made by rust-analyzer but cargo check fails.

image.png

Also every code annotated by #[cfg(compiler)] is greyed out on the wasmtime crate. The build.rs of it dynamically defines rust-cfg=compiler so rust-analyzer is not recognizing this? :shrug:

image.png
(a workaround is setting RUSTFLAGS on rust-analyzer.{cargo, checkOnSave}.extraEnv, but I'm not confident if this is the right path)

These greatly harm development experience and I'm looking for a help to troubleshoot this. Thanks in advance.

view this post on Zulip Nam Junghyun (Nov 24 2022 at 15:18):

Also I tried re-opening this project on Debian Bullseye Docker container, but the same errors occur :(


Last updated: Dec 23 2024 at 12:05 UTC