Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wasmtime_wasi::bindings compilation error for wasi:cli/exit and wasi:socket/network, missing LinkOptions parameter #10119

Open
robherley opened this issue Jan 27, 2025 · 2 comments
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@robherley
Copy link

Test Case

I have a minimal repro in this repository: https://github.com/robherley/wasmtime-bindgen-repro

Steps to Reproduce

  1. Follow the example from wasmtime-wasi crate:
    //! with: {
    //! "wasi": wasmtime_wasi::bindings,
    //! },
  2. Attempt to compile.
  3. Error, need to cargo expand (see my expanded.rs) or add include_generated_code_from_file: true to the macro.

Expected Results

The generated binding have the correction function signatures.

Actual Results

Image

Versions and Environment

Wasmtime version or commit: 29.0.1

Operating system: macOS 15.1.1

Architecture: arm64

Extra Info

The only affected bindings are:

__with_name0::cli::exit::add_to_linker(linker, get)?;
__with_name0::sockets::network::add_to_linker(linker, get)?;

Which are missing &wasmtime_wasi::bindings::cli::exit::LinkOptions and &wasmtime_wasi::bindings::sockets::network::LinkOptions

@robherley robherley added the bug Incorrect behavior in the current implementation that needs fixing label Jan 27, 2025
@robherley
Copy link
Author

I'm guessing this is related to runtime feature-gated options:

Instead, the generated add_to_linker*** functions take an additional LinkOptions parameter if the world/interface has any unstable features.

@alexcrichton
Copy link
Member

Thanks for the report! I think the problem may lie in your original WIT files perhaps? Looking at https://github.com/robherley/wasmtime-bindgen-repro/blob/main/wit/deps/wasi-cli-0.2.3/package.wit I don't see exit-with-code which is a feature-gated API, which means that the two bindgens are starting from different WITs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

No branches or pull requests

2 participants