second-state / wasm-learning

Building Rust functions for Node.js to take advantage of Rust's performance, WebAssembly's security and portability, and JavaScript's ease-of-use. Demo code and recipes.
https://www.secondstate.io/articles/getting-started-with-rust-function/
485 stars 102 forks source link

Fails to compile with go run but succeeds with go build #41

Open chris-aeviator opened 2 years ago

chris-aeviator commented 2 years ago

concerning /reactr/hello

 go run -tags wasmedge main.go
# github.com/suborbital/reactr/rwasm/runtime/wasmedge
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:43:17: undefined: wasmedge.NewWasiImportObject
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:50:20: store.FindFunction undefined (type *wasmedge.Store has no field or method FindFunction)
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:52:39: cannot use "_start" (type string) as type *wasmedge.Function in argument to executor.Invoke
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:56:15: store.FindFunction undefined (type *wasmedge.Store has no field or method FindFunction)
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:58:39: cannot use "init" (type string) as type *wasmedge.Function in argument to executor.Invoke
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:72:40: undefined: wasmedge.ImportObject
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/builder.go:100:13: undefined: wasmedge.NewImportObject
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/host_function.go:27:26: undefined: wasmedge.ImportObject
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/wasmedge.go:13:11: undefined: wasmedge.ImportObject
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/wasmedge.go:19:44: cannot use fn (type string) as type *wasmedge.Function in argument to w.executor.Invoke
/home/korny/go/pkg/mod/github.com/suborbital/reactr@v0.12.1-0.20211208141943-8e8dcbbda027/rwasm/runtime/wasmedge/wasmedge.go:19:44: too many errors

a simple go build on the other hand compiles a binary that runs my rust-wasm code successfully.

go version go1.17.1 linux/amd64
wasmedge version 0.10.0
arch linux
DarumaDocker commented 2 years ago

Reactr depends on WasmEdge-go@v0.9 and there are some breaking changes between v0.9 and v0.10. So you need to install wasmedge@0.9 in your system.

chris-aeviator commented 2 years ago

@DarumaDocker thanks for your reply. This is not documented in the reactr repo nor in wasmedge-go readme (mentions to specificly install 0.10 https://github.com/second-state/WasmEdge-go/blob/master/README.md?plain=1#L22).

Should I make another issue in the reactr repo for this?

DarumaDocker commented 2 years ago

Of course! Then we will put it into our schedule. Thanks