Skip to content

Question around cargo wasi start and testing #192

Open
@derwolfe

Description

@derwolfe

The issue

Hi! I've been using the rust SDK and it's been working quite well for me thus far. I've been interested in pulling in some of web_sys from wasm_bindgen and also wanted to have my tests run in a wasi environment. I followed the directions at https://bytecodealliance.github.io/cargo-wasi/testing.html to try to get my environment bootstrapped, but on attempting to run cargo wasi test the following error was returned.

  = note: rust-lld: error: duplicate symbol: _start
          >>> defined in /Users/cwolfe/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/wasm32-wasi/lib/self-contained/crt1-command.o
          >>> defined in /Users/cwolfe/Code/proxy-wasm-e2etoken-filter/target/wasm32-wasi/debug/deps/proxy_wasm_e2etoken_filter-91c1493ef37ea735.49s9in10l20plzkv.rcgu.o

switching to proxy_wasm::main!, a different error is returned

    0: failed to instantiate "/Users/cwolfe/Code/proxy-wasm-e2etoken-filter/target/wasm32-wasi/debug/deps/proxy_wasm_e2etoken_filter-91c1493ef37ea735.wasm"
    1: Program cannot be both a Command and a Reactor

Why am I asking this here?

There look to be two ways to structure the filter, either by defining a _start entrypoint or using the main! macro that builds the same. It seems like you might have guidance around how I might be able to structure my code get around this.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions