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

[WIT] Tinygo support #682

Closed
wants to merge 1 commit into from
Closed

[WIT] Tinygo support #682

wants to merge 1 commit into from

Conversation

maxence-charriere
Copy link
Owner

@maxence-charriere maxence-charriere commented Jan 10, 2022

summary

This is a try to support tiny go.

status

  • It compiles
  • Compile-time is way too long (around 1 min)
  • wasm binary size gain is about 40%
  • It fails to load wasm file in the browser
    loading wasm failed: LinkError: WebAssembly.instantiate(): Import #15 module="env" function="time.resetTimer" error: function import requires a callable
    
  • os.Getenv/os.Setenv are not supported
  • Require to have separated main for wasm and server

@mar1n3r0
Copy link

mar1n3r0 commented Jan 10, 2022

tinygo-org/tinygo#2350

Don't give up the SetEnv implementation is already in dev branch soon to be merged to master and released. It's more of a camel race rather than one push :)

Please see the thread where the wasm runs in the browser: #534

@oderwat
Copy link
Sponsor Contributor

oderwat commented Jan 15, 2022

I am at the same point with my slightly different approach: The so the next (last?) problem is tinygo-org/tinygo#1037.

@alvarolm
Copy link

alvarolm commented Nov 1, 2022

I am at the same point with my slightly different approach: The so the next (last?) problem is tinygo-org/tinygo#1037.

runtime timers are now implemented (since 0.26.0)
tinygo-org/tinygo#1037 (comment)

also wasm binary size could be reduced even further
https://www.fermyon.com/blog/optimizing-tinygo-wasm

the compile time still is slower

considering the resulting (tinygo) wasm binary size could be less than the go compiler after optimizations, may be its a choice for production build only ?

current output with getting started application:

$  tinygo build -o web/tiny.wasm -target wasm .
tinygo:wasm-ld: error: /tmp/tinygo2210282389/main.o: undefined symbol: time.modTimer
failed to run tool: wasm-ld
error: failed to link /tmp/tinygo2210282389/main: exit status 1

@gedw99
Copy link

gedw99 commented Dec 14, 2022

same with me still

tinygo build -o web/app.wasm -target wasm ./main.go
tinygo:wasm-ld: error: /var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/tinygo1510053506/main.o: undefined symbol: time.modTimer
failed to run tool: wasm-ld

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants