Skip to content

errors when I execute gopherjs build --minify #670

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
Jimmy99 opened this issue Aug 4, 2017 · 6 comments
Closed

errors when I execute gopherjs build --minify #670

Jimmy99 opened this issue Aug 4, 2017 · 6 comments
Labels

Comments

@Jimmy99
Copy link

Jimmy99 commented Aug 4, 2017

I have go version go1.9beta1 linux/amd64 installed on ubuntu
I installed the go executable from the golang.org site
this is my go env :
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/dimitri/projects/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build366941307=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"

While following the blog post "Running gofmt in Browser with 10 Lines of Code (Using GopherJS)" I get the following errors when I execute gopherjs build --minify. Any idea why it's failing?:

../../../../../../../../usr/local/go/src/runtime/error.go:134:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:136:12: undeclared name: CallersFrames ../../../../../../../../usr/local/go/src/runtime/error.go:144:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:148:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:153:3: undeclared name: throw ../../../../../../../../usr/local/go/src/runtime/error.go:156:3: undeclared name: throw

@myitcv
Copy link
Member

myitcv commented Aug 4, 2017

@Jimmy99 per @shurcooL's response this is most likely because you're using Go 1.9.

If you switch to Go 1.8.x does this fix things?

Go 1.9 support will be merged via #651 shortly after Go 1.9 is officially released.

@Jimmy99
Copy link
Author

Jimmy99 commented Aug 4, 2017

I thought that might be the problem. I will try with 1.8

@dmitshur
Copy link
Member

dmitshur commented Aug 4, 2017

Yes, the current master version of GopherJS requires Go 1.8.x. To use GopherJS with Go 1.9, you'll need to use its go1.9 branch, or wait until final release of Go 1.9 comes out, then go1.9 branch will be merged to master (as @myitcv said).

Also note you need to recompile the gopherjs binary after changing your Go version. GopherJS is a compiler that's closely tied to Go and uses the standard library in GOROOT, which is why this is the case.

@dmitshur
Copy link
Member

dmitshur commented Aug 4, 2017

I think we can help improve the situation by detecting when the installed Go version doesn't match the gopherjs binary and print a more helpful error message. I filed #671 to track that.

@dmitshur
Copy link
Member

dmitshur commented Aug 4, 2017

Also filed #672 to consider using a different approach, one that wouldn't suffer from this issue altogether (but has other costs that may not make it worth it).

@flimzy
Copy link
Member

flimzy commented Apr 9, 2021

I believe this issue has now been resolved, as gopherjs now complains with the wrong version of the go stdlib. Additionally, you can use a mismatched version with the GOPHERJS_GOROOT envrionment variable.

If this needs any additional attention, please comment and we'll be happy to re-open.

@flimzy flimzy closed this as completed Apr 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants