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

cmd/dist: don't build tools for wasm build #25911

Closed
bradfitz opened this issue Jun 15, 2018 · 10 comments
Closed

cmd/dist: don't build tools for wasm build #25911

bradfitz opened this issue Jun 15, 2018 · 10 comments
Labels
arch-wasm WebAssembly issues FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@bradfitz
Copy link
Contributor

When running make.bash for GOOS=js GOARCH=wasm, we build a bunch of never-used tools (dist, api, gofmt, etc).

Low priority, but look into skipping those to save time/space.

Okay for Go 1.11 if somebody wants to do it, but marking Unplanned.

/cc @neelance

@bradfitz bradfitz added help wanted NeedsFix The path to resolution is known, but the work has not been done. arch-wasm WebAssembly issues labels Jun 15, 2018
@bradfitz bradfitz added this to the Unplanned milestone Jun 15, 2018
@agnivade
Copy link
Contributor

I get this -

GOOS=js GOARCH=wasm ./make.bash
cmd/go: unsupported GOOS/GOARCH pair js/wasm

What am I missing ?

@bradfitz
Copy link
Contributor Author

@agnivade, that's the complete output? I don't see how that's possible. There are echo statements in make.bash before it ever runs go.

@agnivade
Copy link
Contributor

Figured it out. It is this line which runs before the echo statements - https://github.com/golang/go/blob/master/src/make.bash#L144.

goroot=$(GOROOT='' "$go_exe" env GOROOT)

I am using Go1.10 to bootstrap. Hence it does not support js/wasm pair. Should I use the tip binary itself to bootstrap ?

Also, how do I run tests ? I see this -

22:58:34-agniva-~/play/gosource/go/src$GOOS=js GOARCH=wasm ../bin/go test encoding/hex
fork/exec /tmp/go-build165629863/b001/hex.test: exec format error
FAIL	encoding/hex	0.001s

Obviously wasm won't run natively. Do I need to use go_js_wasm_exec somewhere ?

@bradfitz
Copy link
Contributor Author

I'm bootstrapping with Go 1.4, but make.bash works for me. What is your complete output of make.bash when it fails and what is your environment?

Yes, you need go_js_wasm_exec in your $PATH, and you need nodejs installed to run the "node" binary.

@agnivade
Copy link
Contributor

What is your complete output of make.bash when it fails and what is your environment?

That is it :)

23:45:20-agniva-~/play/gosource/go/src$GOOS=js GOARCH=wasm ./make.bash
cmd/go: unsupported GOOS/GOARCH pair js/wasm

linux/amd64. Ubuntu 16.04.

Just guessing, but probably 1.4 does not have an explicit whitelist of GOOS/GOARCH pairs like 1.10 ?

Yes, you need go_js_wasm_exec in your $PATH, and you need nodejs installed to run the "node" binary.

Ah gotcha.

@bradfitz
Copy link
Contributor Author

You didn't answer the question about what is in your environment. Do you define GOROOT_BOOTSTRAP?

Just guessing, but probably 1.4 does not have an explicit whitelist of GOOS/GOARCH pairs like 1.10 ?

Might be related, but I can build js/wasm with go1.10:

$ GOROOT_BOOTSTRAP=$HOME/go1.10 GOOS=js GOARCH=wasm ./make.bash 
Building Go cmd/dist using /home/bradfitz/go1.10.
Building Go toolchain1 using /home/bradfitz/go1.10.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
...

@agnivade
Copy link
Contributor

Ah, by environment, you meant environment variables. No I am not defining GOROOT_BOOTSTRAP. And by explicitly defining it, it works because it bypasses that check on L144 :)

01:10:37-agniva-~/play/gosource/go/src$GOROOT_BOOTSTRAP=/usr/local/go GOOS=js GOARCH=wasm ./make.bash
Building Go cmd/dist using /usr/local/go.
Building Go toolchain1 using /usr/local/go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for host, linux/amd64.
Building packages and commands for target, js/wasm.
---
Installed Go for js/wasm in /home/agniva/play/gosource/go
Installed commands in /home/agniva/play/gosource/go/bin

Thank you for helping me debug this.

@bradfitz
Copy link
Contributor Author

@agnivade, want to resume work on this now?

@agnivade
Copy link
Contributor

Yea I had. But faced minor bumps while persevering through the code.

I can see that the tooldir variable holds the location for the tools getting built. And where the tools like link, compile and asm are getting built. But I can't figure out where is the other stuff like gofmt, api are getting built. Any pointers to those will be very helpful.

@gopherbot
Copy link

Change https://golang.org/cl/120655 mentions this issue: cmd/dist: skip building tools for js/wasm

@golang golang locked and limited conversation to collaborators Jul 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly issues FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants