Giter Club home page Giter Club logo

Comments (17)

mastersingh24 avatar mastersingh24 commented on July 20, 2024 2

The fix for this issue is to update to the latest version of wagon ... and then you'll hit go-interpreter/wagon#69

from life.

Xe avatar Xe commented on July 20, 2024 1

I have gotten this working in olin.

Relevant commits:

Example web assembly module and its output:

xena at luna in ~/go/src/github.com/Xe/olin/internal/abi/wasmgo on master
❯ go test -v
=== RUN   TestWasmGo
=== RUN   TestWasmGo/github.com/Xe/olin/internal/abi/wasmgo.testNothing
nothing
--- PASS: TestWasmGo (1.66s)
    --- PASS: TestWasmGo/github.com/Xe/olin/internal/abi/wasmgo.testNothing (1.66s)
PASS
ok      github.com/Xe/olin/internal/abi/wasmgo  1.696s

More info here.

from life.

mastersingh24 avatar mastersingh24 commented on July 20, 2024 1

@Xe - syscall/js is always included when building for the js/wasm platform. The current model in Go1.11 basically assumes that your Web Assembly runtime is the browser. And the only way to pass anything between the host and the WASM module is via the syscall/js callback APIs.

from life.

gladkikhartem avatar gladkikhartem commented on July 20, 2024 1

Hi guys,
I've managed to create a minimal, hardcoded exec.ImportResolver that can actually work with Go1.11 GOOS=js GOARCH=wasm executables.
You could use it for tinkering around or getting ideas about creating your own stuff.
It's definitely gonna change as i'm going to adapt it to event-sourcing and concurrency, but it's at least something.
What i have here is:
panic printing
Log() function
Call() function that allows you to asynchronously handle Callbacks, once VM is waiting for external event.
see usage example at: https://gitlab.com/albert_einstein/kwasm/tree/master/example

Any usage of other external communications (i.e. stdin,/stdout, http, sockets, files and etc) will cause your VM to mysteriously fail.

from life.

TUSF avatar TUSF commented on July 20, 2024 1

Instead of trying to support go's js/wasm target, how about wasi/wasm?

https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
https://github.com/CraneStation/wasmtime/blob/master/docs/WASI-api.md

Relevant issue: golang/go#31105

from life.

julioholon avatar julioholon commented on July 20, 2024

Friends, we are still having this issue, even using the updated version of wagon (using @mastersingh24 's fork). Anyone able to use life at the moment?

from life.

Xe avatar Xe commented on July 20, 2024

Keeping this thread updated: it seems that including most of the standard library brings in syscall/js somehow. This is getting annoying fast. I am going to fork the Go compiler with a custom GOOS (olin or dagger, can't pick which) at https://github.com/Xe/go. I will need to do a lot of low-level runtime hacking in order to genericize the code for js/wasm to work on webassembly in general, while still offering the Javascript features for things that need JS.

from life.

Xe avatar Xe commented on July 20, 2024

Yay weird linker errors: Xe/go@37bc30e

from life.

 avatar commented on July 20, 2024

from life.

dobegor avatar dobegor commented on July 20, 2024

@mastersingh24 could you please update us on the status of this issue?
I thought go-interpreter/wagon#69 was going to be closed in go-interpreter/wagon#70, but that hasn't been merged yet.

from life.

Immortalin avatar Immortalin commented on July 20, 2024

@mastersingh24 how much of browser runtime can be pulled into life?

from life.

Immortalin avatar Immortalin commented on July 20, 2024

Can we use something like Otto to replace the JS runtime?

from life.

Xe avatar Xe commented on July 20, 2024

I have looked into using Otto to replace the JS runtime. I don't feel comfortable doing it because I don't know how much deviation it has from how browser JS does it.

from life.

Immortalin avatar Immortalin commented on July 20, 2024

Any updates with Go 1.12?

from life.

mastersingh24 avatar mastersingh24 commented on July 20, 2024

Go 1.12 is actually no better here.
FWIW - people might want to checkout tinygo ... it creates much cleaner WASM and does not assume the browser as the host environment

from life.

Xe avatar Xe commented on July 20, 2024

I got parts of the runtime working in Olin. Here's the code: https://github.com/Xe/olin/tree/master/internal/abi/wasmgo

from life.

Xe avatar Xe commented on July 20, 2024

The wasi/wasm target post-dates this issue

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.