gopherjs: internal/poll: fails to build on Windows
What version of Go are you using (go version)?
go version go1.9 windows/amd64
What version of GopherJS are you using ?
GopherJS 1.9-1
What did you do?
cat src/hello/main.go
package main
import (
"github.com/gopherjs/gopherjs/js"
"fmt"
)
func SayHello(name string) string {
fmt.Println("Hello", name)
return "Hello " + name
}
func main() {
js.Module.Get("exports").Set("SayHello", SayHello)
}
gopherjs build hello/main.go
What did you expect to see?
No errors
What did you see instead?
..\..\..\..\..\..\Go\src\internal\poll\fd_windows.go:367:22: invalid operation: fd.pd (variable of type pollDesc) has no field or method runtimeCtx
..\..\..\..\..\..\Go\src\internal\poll\fd_windows.go:368:22: invalid operation: fd.pd (variable of type pollDesc) has no field or method runtimeCtx
..\..\..\..\..\..\Go\src\internal\poll\fd_windows.go:157:5: invalid operation: o.fd.pd (variable of type pollDesc) has no field or method runtimeCtx
I think the bug is caused by commit 956dce4
About this issue
- Original URL
- State: open
- Created 7 years ago
- Reactions: 2
- Comments: 20 (10 by maintainers)
Commits related to this issue
- Document supported GOOS values. Add instructions for what people should do when building with GopherJS on unsupported platforms. Code generation works completely fine, but syscalls (e.g., for gopherj... — committed to gopherjs/gopherjs by dmitshur 6 years ago
- README: Document supported GOOS values. (#777) Add instructions for what people should do when building with GopherJS on unsupported platforms. Code generation works completely fine, but syscalls (... — committed to gopherjs/gopherjs by dmitshur 6 years ago
Good to hear.
It certainly is. That’s why this issue is open and has bug, NeedsFix labels.
It will be nice to fix this issue, but, that doesn’t mean the environments can be consistent.
GOOS
andGOARCH
environment variables are effectively arguments to the Go compiler. The GopherJS compiler also uses theGOOS
environment variable in the same way. You can read more about it at https://golang.org/doc/install/source#environment.So, you’re expected to set
GOOS
orGOARCH
as needed depending on what target you want to compile for (i.e., cross-compilation). Also see https://medium.com/@rakyll/go-1-5-cross-compilation-488092ba44ec for more information on cross-compilation.Okay, I investigated this and posted #693. My original plan to resolve this issue was to make
gopherjs
always build for the same supported GOOS value. That way, I could fix Windows without actually having to use it.Unfortunately, that proposal won’t work exactly as I imagined it (a 2 line PR), and fixing Windows support is going to be more work.
I can’t afford to spend time on supporting Windows now, so I won’t be actively working on this.
You can either continue to use
GOOS=darwin gopherjs build
, etc., for building JavaScript for running in the browser, or use a supported OS (perhaps in a VM). Or maybe someone else will want to work on fixing Windows. Sorry about the inconvenience.fails for me too on win10 too btw.
I can reproduce locally on macOS: