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

Question around cargo wasi start and testing #192

Open
derwolfe opened this issue Apr 5, 2023 · 0 comments
Open

Question around cargo wasi start and testing #192

derwolfe opened this issue Apr 5, 2023 · 0 comments

Comments

@derwolfe
Copy link

derwolfe commented Apr 5, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant