Giter Club home page Giter Club logo

Comments (6)

glycerine avatar glycerine commented on July 20, 2024 3

@losfair I'm surprised you aren't compiling from Go, since Life is written in Go. Out of curiousity, how are you generating your wasm code to run on Life?

from life.

iwasaki-kenta avatar iwasaki-kenta commented on July 20, 2024

Hello,

Life itself focuses on execution of pure WebAssembly modules; Go modules compiled down to WebAssembly require some external functions to be available under a namespace titled go (hence the unknown module: go error).

In order to support Go modules compiled down to WebAssembly, it is a matter of creating an import resolver that provides implementations of all the external functions necessary under go (instructions denoted on README).

Import resolvers may be created for supporting virtually any kind of functionality; even for supporting interfacing with the GPU or creating a GUI straight from a WebAssembly module for example.

The .js build one gets from building a Go module into WebAssembly contains a browser-based JavaScript implementation of the go namespace, which actually can be ported over into an import resolver that may be used in Life.

We would really love for any initial work done by the community for specifically supporting Go modules compiled down to WebAssembly, or otherwise look into further work on having the Go compiler spit out pure WebAssembly modules (rather than rely on an external set of functions from a defined go namespace).

It unfortunately isn't one of our biggest priorities right now to be creating stub implementations for said import resolvers, though we are more than happy to help should anyone look to kickstart one off (for Go for example).

from life.

miguelmota avatar miguelmota commented on July 20, 2024

Having the same problem

package main

import "fmt"

func main() {
	fmt.Println("Hello, WebAssembly!")
}
GOOS=js GOARCH=wasm go build -o main.wasm
$ ./life -entry '' main.wasm
Resolve func: go debug
panic: unknown module: go

goroutine 1 [running]:
main.main()
        /Users/mota/.gvm/pkgsets/go1.11/global/src/github.com/perlin-network/life/main.go:79 +0x886

would be helpful to see a working example of compiling Go to WASM that can be resolved by this library

from life.

glycerine avatar glycerine commented on July 20, 2024

@losfair It's fair to lock this issue to prevent me toos. But it still an open issue that most who try Life with Go will hit. Closing it is misleading. And it deters community contribution; which was requested above.

from life.

losfair avatar losfair commented on July 20, 2024

@glycerine Life itself is a virtual machine and we think runtime support like the Go runtime is out of scope of this project. Discussions in #23 provide some suggestions on running Go on Life though.

from life.

Irooniam avatar Irooniam commented on July 20, 2024

Hello,

anyone have any luck using Life's Import resolvers to use go-compiled wasm modules within Life?

from life.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.