Comments (6)
@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.
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.
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.
@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.
@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.
Hello,
anyone have any luck using Life's Import resolvers to use go-compiled wasm modules within Life?
from life.
Related Issues (20)
- There is a problem in the judgment of was unreachable
- Snapshotting
- Compile once, execute many times
- inconsistent stack pattern: pt = false, lpt = false, ls = 2, sd = 0 HOT 2
- Comparison to V8
- Gas on StartSection
- User-friendly Fix: Need to panic that DefaultMemoryPages config option should be 1 or more HOT 2
- Is it possible to run go generated WASMs in the VM? HOT 1
- Call wasm function with string parameter?
- too many arguments in call to disasm.Disassemble HOT 3
- SSA advantages HOT 1
- How AddGas injected? HOT 1
- I use emcc compile a simple cpp to wasm. but can't works in `life` HOT 1
- Can it load multiple wasm file?
- why retrun value 0 when enable polymerase?
- Add golangci linter
- WASI support
- No exported functions HOT 1
- Floating point operation is very inaccurate
- cannot return error while panic
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from life.