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

misc/wasm: wasm_exec.js missing after toolchain update #69989

Closed
ericcornelissen opened this issue Oct 22, 2024 · 2 comments
Closed

misc/wasm: wasm_exec.js missing after toolchain update #69989

ericcornelissen opened this issue Oct 22, 2024 · 2 comments

Comments

@ericcornelissen
Copy link

Go version

go version go1.23.0 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/eric/.cache/go-build'
GOENV='/home/eric/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/eric/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/eric/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/eric/go/pkg/mod/golang.org/[email protected]'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/eric/go/pkg/mod/golang.org/[email protected]/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.0'
GODEBUG=''
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/eric/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/eric/workspace/ades/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build283257350=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I updated my Go toolchain version using the Go command's update functionality (I believe this happens automatically when using the go command when the Go version in go.mod doesn't match the current version) and then tried to copy the wasm_exec.js file - following https://go.dev/wiki/WebAssembly - to be able to run WASM compiled Go code in the browser.

What did you see happen?

An error the wasm_exec.js file was not found:

$ cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .
cp: cannot stat '/home/eric/go/pkg/mod/golang.org/[email protected]/misc/wasm/wasm_exec.js': No such file or directory

if and only if I use a version of the go command from a toolchain update. I verified this error does not occur when Go was installed at go version go1.23.0 linux/amd64 directly.

What did you expect to see?

No error and the file is copied:

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

(I know the guide says cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" . - with lib instead of misc - but, at least on Go go version go1.22.5 linux/amd64 and go version go1.23.0 linux/amd64 only misc works.)

@ericcornelissen
Copy link
Author

ericcornelissen commented Oct 22, 2024

My bad, this is answered by #68024 - thanks @gabyhelp for helping me find it 🙂

It also explains my confusing with regards to:

I know the guide says cp "$(go env GOROOT)/lib/wasm/wasm_exec.js" . - with lib instead of misc - but, at least on Go go version go1.22.5 linux/amd64 and go version go1.23.0 linux/amd64 only misc works.

because in 1.24.0 it will be in lib instead of misc.

(perhaps the wording here will help other Unix users find the issue too).

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

No branches or pull requests

2 participants