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

How to run .wasmer binary with go? #412

Closed
oosawy opened this issue Dec 22, 2024 · 1 comment
Closed

How to run .wasmer binary with go? #412

oosawy opened this issue Dec 22, 2024 · 1 comment
Labels
❓ question Further information is requested

Comments

@oosawy
Copy link

oosawy commented Dec 22, 2024

Summary

How to run .wasmer binary with go? I tried wasmer.DeserializeModule() and it fails with incompatible binary: The provided bytes are not wasmer-universal.

Additional details

I want to embed a package distributed on wasmer.io and I noticed it's not just well-known wasm binary after tried running the binary with another wasm runtime. It's works with wasmer run but I could not run with go.

Reproduction

  1. Donwload binary from https://wasmer.io/syrusakbary/cowsay/releases
  2. See how waasmer run works: wasmer run cowsay-v0.3.0.wasmer hello
  3. It fails with incompatible binary: The provided bytes are not wasmer-universal
package main

import (
	"fmt"
	"os"

	"github.com/wasmerio/wasmer-go/wasmer"
)

func main() {
	wasmBytes, err := os.ReadFile("cowsay-v0.3.0.wasmer")
	if err != nil {
		fmt.Println(err)
		return
	}

	engine := wasmer.NewEngine()
	store := wasmer.NewStore(engine)

	module, err := wasmer.DeserializeModule(store, wasmBytes)
	if err != nil {
		fmt.Println(err)
		return
	}

	_ = module
}
@oosawy oosawy added the ❓ question Further information is requested label Dec 22, 2024
@oosawy
Copy link
Author

oosawy commented Jan 13, 2025

There seems to be no API in Golang.

@oosawy oosawy closed this as completed Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❓ question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant