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

WebAssembly example not work on browser on phone #35341

Closed
lucklove opened this issue Nov 4, 2019 · 11 comments
Closed

WebAssembly example not work on browser on phone #35341

lucklove opened this issue Nov 4, 2019 · 11 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@lucklove
Copy link

lucklove commented Nov 4, 2019

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

$ go version
go version go1.12.5 darwin/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/joshua/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/joshua/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/pb/ssv6rnq92pn_l3c9gr9rd1g80000gn/T/go-build378228854=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

As this page shows, but change the code to:

package main

import "fmt"
import "syscall/js"

func main() {
	fmt.Println("Hello, WebAssembly!")
	js.Global().Get("document").Call("write", "Hello, WebAssembly!")
}

What did you expect to see?

"Hello, WebAssembly!"

What did you see instead?

nothing

@lucklove
Copy link
Author

lucklove commented Nov 4, 2019

Maybe related: #27462

@smasher164
Copy link
Member

I am unable to reproduce this behavior.
Are you sure you are using the appropriate wasm_exec.js with

$ cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .

@smasher164 smasher164 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 4, 2019
@lucklove
Copy link
Author

lucklove commented Nov 5, 2019

@smasher164 yes, I did copy correct wasm_exec.js.
My code works on PC, but does not work phone. Do you open it in your phone?

@agnivade
Copy link
Contributor

agnivade commented Nov 5, 2019

Please use 1.13.4 and let us know if you still see issues.

@agnivade agnivade added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Nov 5, 2019
@lucklove
Copy link
Author

lucklove commented Nov 5, 2019

@agnivade not work still
image

@agnivade
Copy link
Contributor

agnivade commented Nov 5, 2019

Would you be able to provide the console logs from the phone ? That would be very helpful in debugging this.

@smasher164
Copy link
Member

Could you also list your phone's OS/Browser version? For instance, I tested on iPhone X, iOS 13.1.13, Chrome 77.0.3865.103. Thanks

@lucklove lucklove changed the title WebAssembly example not work on chrome on phone WebAssembly example not work on browser on phone Nov 6, 2019
@lucklove
Copy link
Author

lucklove commented Nov 6, 2019

Sorry, @agnivade , @smasher164 , my mistake, it's not chrome, it's my phone's builtin browser. This error is from safari on iPhone(my friends's phone):
image

@lucklove
Copy link
Author

lucklove commented Nov 6, 2019

The chrome works correctly

@agnivade
Copy link
Contributor

agnivade commented Nov 6, 2019

The index.html file that you are using is incorrect. Please use the file from "$(go env GOROOT)/misc/wasm/wasm_exec.html"

EDIT: Also note this line from the wiki:

If your browser doesn’t yet support WebAssembly.instantiateStreaming, you can use a polyfill.

@agnivade agnivade added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Nov 6, 2019
@lucklove
Copy link
Author

lucklove commented Nov 6, 2019

@agnivade get it! thank you!

@lucklove lucklove closed this as completed Nov 6, 2019
@golang golang locked and limited conversation to collaborators Nov 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants