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

Closed
gazhayes opened this issue Aug 25, 2019 · 9 comments
Labels
Documentation FrozenDueToAge help wanted mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@gazhayes
Copy link

gazhayes 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 Android, iOS, and x/mobile label Aug 25, 2019
@smasher164
Copy link
Member

smasher164 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
Copy link
Author

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
Copy link
Contributor

bcmills 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
Copy link
Contributor

bcmills commented Aug 26, 2019

Module-mode support for gomobile is #27234.

@bcmills bcmills added Documentation NeedsFix The path to resolution is known, but the work has not been done. labels Aug 26, 2019
@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
Copy link
Contributor

bcmills commented Aug 26, 2019

CC @hyangah @steeve

@lexis-t
Copy link

lexis-t commented Oct 8, 2019

Hello. Any news or at least workarounds on this? What steps are needed to make gobind workable in this situation?

@hajimehoshi
Copy link
Member

Hello. Any news or at least workarounds on this? What steps are needed to make gobind workable in this situation?

Specifying GO111MODULE=off should solve the issue.

@myroid
Copy link

myroid commented Nov 12, 2019

GO111MODULE=off go get -d golang.org/x/mobile/example/basic

@hyangah
Copy link
Contributor

hyangah commented Nov 21, 2019

Updated the wiki page.

@hyangah hyangah closed this as completed Nov 21, 2019
@golang golang locked and limited conversation to collaborators Nov 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge help wanted mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

8 participants