We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I have a small go file:
package w func sum(x, y int) int { return x + y }
I build it to a wasm blob:
GOOS=js GOARCH=wasm go build -o web.wasm w/w.go
But when running wasmer.NewInstance on it, I get:
wasmer.NewInstance
Failed to instantiate the module: compile error: Validation error "Bad magic number"
Does go not build compatible wasm blobs?
The text was updated successfully, but these errors were encountered:
wasm2wat tells me the same. The resulting web.wasm file contains this:
wasm2wat
web.wasm
!<arch> __.PKGDEF 0 0 0 644 118 ` go object js wasm go1.12.8 X:framepointer build id "f4e5LZ0A-5ohVijh4Sns/xwk6yYDmaERJ6X8P8yL1" $$B i
Sorry, something went wrong.
I'm not sure Go can generate a WebAssembly module from a library only, it seems to work for a binary only.
I'm closing the issue since it's not related to this project, but feel free to re-open at any moment :-)!
For future explorers of the Wasm frontiers, I have gotten past this problem by compiling to wasm with tinygo
tinygo
Yup, tinygo seems a nice solution for this kind of usage.
Hywan
No branches or pull requests
I have a small go file:
I build it to a wasm blob:
But when running
wasmer.NewInstance
on it, I get:Does go not build compatible wasm blobs?
The text was updated successfully, but these errors were encountered: