Skip to content

misc/wasm: this._inst.exports.getsp is not a function #28924

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

Closed
gin opened this issue Nov 22, 2018 · 4 comments
Closed

misc/wasm: this._inst.exports.getsp is not a function #28924

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

Comments

@gin
Copy link

gin commented Nov 22, 2018

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

$ go version
go version go1.11.2 darwin/amd64

Does this issue reproduce with the latest release?

Master - aff2f6e

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

go env Output
$ go env
GOARCH="amd64"
GOBIN="/bin"
GOCACHE="/Users/Alice/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/Alice/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/Cellar/go/1.11.2/libexec"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.11.2/libexec/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/vj/v3j_lwgj08z4prwybz82mjgr0000gp/T/go-build089334516=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

  1. Download wasm_exec.html and wasm_exec.js
$ curl -sO https://raw.githubusercontent.com/golang/go/master/misc/wasm/wasm_exec.html
$ curl -sO https://raw.githubusercontent.com/golang/go/master/misc/wasm/wasm_exec.js
  1. Create a wasm file that print string to console
    e.g. main.go
package main
import "fmt"
func main() {
        fmt.Println("Hello, go/WASM!")
}
$ GOOS=js GOARCH=wasm go build -o test.wasm main.go
  1. Serve the files
    e.g. server.go
package main
import "net/http"
func main() {
        http.ListenAndServe(":8000", http.FileServer(http.Dir(".")))
}
$ go run server.go
  1. Go to the URL in the browser
    (tried Chrome 70.0.3538.102 (Official Build) (64-bit))
    (tried Chrome 72.0.3618.0 (Official Build) canary (64-bit)
    e.g.
http://localhost:8000/wasm_exec.html

What did you expect to see?

e.g.
When using wasm_exec.js
from commit 9627180 from 2018-10-25
(which is the latest commit where the bug did not appear)

Hello, go/WASM!           wasm_exec.js:47

What did you see instead?

When using wasm_exec.js
from commit 6dd70fc (2018-11-10)
from commit d7183ca (2018-11-20)
from commit aff2f6e (2018-11-20)

wasm_exec.js:267 Uncaught (in promise) TypeError: this._inst.exports.getsp is not a function
    at syscall/js.valueGet (wasm_exec.js:267)
    at syscall_js.valueGet (wasm-function[1080]:7)
    at syscall_js.Value.Get (wasm-function[1065]:124)
    at syscall_js.init (wasm-function[1078]:696)
    at syscall.init (wasm-function[1109]:458)
    at os.init (wasm-function[1142]:472)
    at fmt.init (wasm-function[1616]:336)
    at main.init (wasm-function[1620]:216)
    at runtime.main (wasm-function[457]:1075)
    at _rt0_wasm_js (wasm-function[868]:71)
    at global.Go.run (wasm_exec.js:410)
    at run (wasm_exec.html:41)
    at HTMLButtonElement.onclick (wasm_exec.html:46)
@cherrymui
Copy link
Member

$ go version
go version go1.11.2 darwin/amd64

$ curl -sO https://raw.githubusercontent.com/golang/go/master/misc/wasm/wasm_exec.html
$ curl -sO https://raw.githubusercontent.com/golang/go/master/misc/wasm/wasm_exec.js

Are you using Go 1.11.2 but with wasm_exec.{html,js} at tip? Mixing them doesn't work. You'll need to use the same version of Go and wasm_exec.{html,js}.

@agnivade agnivade added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 23, 2018
@anymost
Copy link

anymost commented Nov 24, 2018

The same issue I found

@gin
Copy link
Author

gin commented Nov 26, 2018

@cherrymui I see. Thank you for the reply.
In that case, issue can be closed.

@anymost Like me, you probably mixed 1.11.2 with master's wasm_exec.{html,js}.
Instead, use https://raw.githubusercontent.com/golang/go/release-branch.go1.11/misc/wasm/wasm_exec.js
or compile Go binary from source at master.

@gin gin closed this as completed Nov 26, 2018
@anymost
Copy link

anymost commented Nov 28, 2018

@gin thanks, I'll try

@golang golang locked and limited conversation to collaborators Nov 28, 2019
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

5 participants