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

wasm: no standard output on Windows #32774

Open
jb2martel opened this issue Jun 25, 2019 · 5 comments

Comments

@jb2martel
Copy link

commented Jun 25, 2019

What version of Go are you using (go version)?

$ go version
go version go1.12.6 windows/amd64

Does this issue reproduce with the latest release?

NA

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\jdemartel\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\jdemartel\go
set GOPROXY=
set GORACE=
set GOROOT=c:\go
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\JDEMAR~1\AppData\Local\Temp\go-build750286854=/tmp/go-build -gno-record-gcc-switches

What did you do?

  • Write a hello world go program
Source code
package main

import (
	"fmt"
	"os"
)

func main() {
	fmt.Println("standard output")
	os.Exit(0)
}
  • Compile to webassembly using GOOS=js GOARCH=wasm go build -o main.wasm main.go
  • Run the compiled code using node and the supplied wasm_exec.js:
    node wasm_exec.js main.wasm
    • On linux, this works fine
    • On windows, no output appears in terminal, whether it's git bash, command prompt or powershell

What did you expect to see?

As the node versions (v12.4.0) and input files (wasm_exec.js and main.wasm) are identical, I would expect it to work on windows.

What did you see instead?

No terminal output on windows. The command completes with no output in terminal, whether it's command prompt, git bash or powershell.

This is probably a mistake on my part rather than a bug - I guess I'm missing something but can't seem to find any related information.

Thank you for your help !

EDIT: added go source code

@jb2martel

This comment has been minimized.

Copy link
Author

commented Jun 25, 2019

Note: C++ code compiled to wasm using emscripten works fine in the windows environnement, so it's probably not just my windows / node setup.

@andybons andybons changed the title Webassembly - Windows - No standard Output wasm: no standard output on Windows Jun 25, 2019

@andybons andybons added this to the Unplanned milestone Jun 25, 2019

@andybons

This comment has been minimized.

Copy link
Member

commented Jun 25, 2019

@andybons andybons added the OS-Windows label Jun 25, 2019

@jb2martel

This comment has been minimized.

Copy link
Author

commented Jul 1, 2019

Is there anything I can do to help investigate and/or advance the issue ?
I really don't know where to start and would appreciate any tips.
Thanks!

@benshi001

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

Please try go1.13, I can see "hello" printed with

go-1.13 for windows/amd64
node 10.16
windows server 2008 R2

open a cmd window

set GOOS=js
set GOARCH=wasm
go build a.go
node wasm_exec.js a

The a.go is

package main
import "fmt"
func main() {
	fmt.Println("hello")
}
@andybons

This comment has been minimized.

Copy link
Member

commented Sep 11, 2019

@jb2martel is this still an issue for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.