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

x/mobile/cmd/gomobile: update wiki instructions to explicitly set GO111MODULE as needed #33822

Open
gazhayes opened this issue Aug 25, 2019 · 5 comments

Comments

@gazhayes
Copy link

commented Aug 25, 2019

The instructions here do not work for me on OSX with 1.12.9:

Gareths-MacBook-Pro-103:~ gareth$ go get golang.org/x/mobile/cmd/gomobile
go: finding golang.org/x/mobile/cmd/gomobile latest
go: finding golang.org/x/mobile/cmd latest
go: finding golang.org/x/mobile latest
Gareths-MacBook-Pro-103:~ gareth$ go get -d golang.org/x/mobile/example/basic
go: finding golang.org/x/mobile/example/basic latest
go: finding golang.org/x/mobile/example latest
go: finding golang.org/x/mobile latest
Gareths-MacBook-Pro-103:~ gareth$ gomobile build -target=android golang.org/x/mobile/example/basic
gomobile: cannot find package "golang.org/x/mobile/example/basic" in any of:
	/usr/local/go/src/golang.org/x/mobile/example/basic (from $GOROOT)
	/Users/gareth/go/src/golang.org/x/mobile/example/basic (from $GOPATH)

My gopath does not have src/golang.org/x/mobile/example/basic after this. Should it?

Building with go itself works however and the resulting binary executes successfully:

Gareths-MacBook-Pro-103:~ gareth$ go build golang.org/x/mobile/example/basic
go: finding golang.org/x/mobile/example/basic latest
go: finding golang.org/x/mobile/example latest
go: finding golang.org/x/mobile latest
# golang.org/x/mobile/app
darwin_desktop.m:51:1: warning: method possibly missing a [super prepareOpenGL] call [-Wobjc-missing-super-calls]

My gopath still does not have src/golang.org/x/mobile/example/basic after this, but it somehow builds successfully.

gomobile init also fails:

Gareths-MacBook-Pro-103:~ gareth$ gomobile init
gomobile: /usr/local/go/bin/go install golang.org/x/mobile/cmd/gobind failed: exit status 1
can't load package: package golang.org/x/mobile/cmd/gobind: cannot find package "golang.org/x/mobile/cmd/gobind" in any of:
	/usr/local/go/src/golang.org/x/mobile/cmd/gobind (from $GOROOT)
	/Users/gareth/go/src/golang.org/x/mobile/cmd/gobind (from $GOPATH)

Tried getting gobind:

Gareths-MacBook-Pro-103:~ gareth$ go get golang.org/x/mobile/cmd/gobind
go: finding golang.org/x/mobile/cmd/gobind latest
go: finding golang.org/x/mobile/cmd latest
go: finding golang.org/x/mobile latest

Still doesn't work. Tried installing gobind, and now have a gobind binary:

Gareths-MacBook-Pro-103:~ gareth$ gobind
2019/08/25 13:02:43 go [list -e -json -compiled=true -test=false -export=false -deps=true -find=false -tags  --]: exit status 1: go: cannot find main module; see 'go help modules'

Still doesn't work.

I'm new to Go and currently fighting very hard with the way it organises things which doesn't seem to make any sense to me (at all) yet, so it's quite likely that I'm simply missing something basic, no idea what though. Any ideas?

My environment for reference:

Gareths-MacBook-Pro-103:~ gareth$ go env
GOARCH="amd64"
GOBIN="/Users/gareth/go/bin"
GOCACHE="/Users/gareth/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/gareth/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
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/mn/nbstq9512pb9qx1k6x12ph5w0000gn/T/go-build322501253=/tmp/go-build -gno-record-gcc-switches -fno-common"

@gazhayes gazhayes changed the title Gomobile instructions broken for OSX with 1.12.9 Gomobile instructions appear broken for OSX with 1.12.9 Aug 25, 2019

@smasher164 smasher164 changed the title Gomobile instructions appear broken for OSX with 1.12.9 x/mobile/cmd/gomobile: instructions appear to be broken for OSX with 1.12.9 Aug 25, 2019

@gopherbot gopherbot added this to the Unreleased milestone Aug 25, 2019

@gopherbot gopherbot added the mobile label Aug 25, 2019

@smasher164

This comment has been minimized.

Copy link
Member

commented Aug 25, 2019

Can you list the output for go version as well as which go? I am unable to reproduce the build error on my system (same environment), so I would like to make sure that you do not have multiple installations of go on your system. /cc @eliasnaur

@gazhayes

This comment has been minimized.

Copy link
Author

commented Aug 25, 2019

Thanks @smasher164, sure:

$ go version
go version go1.12.9 darwin/amd64
$ which go
/usr/local/go/bin/go

$ which gomobile
/Users/gareth/go/bin/gomobile

This is strange though:

$ gomobile version
gomobile version unknown: binary is out of date, re-install it

Rebuilding makes no difference.

@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 26, 2019

Your go get is running in module mode (as demonstrated by the non-empty GOMOD variable in go env). However, the gomobile build command is running in GOPATH mode (as demonstrated by the error message mentioning GOPATH in the searched paths).

@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 26, 2019

Module-mode support for gomobile is #27234.

@bcmills bcmills changed the title x/mobile/cmd/gomobile: instructions appear to be broken for OSX with 1.12.9 x/mobile/cmd/gomobile: update wiki instructions to explicitly set GO111MODULE as needed Aug 26, 2019

@bcmills bcmills added the help wanted label Aug 26, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Aug 26, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.