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: claims to require 1.7+ but actually requires 1.9+ #29486

Closed
AxbB36 opened this issue Dec 31, 2018 · 1 comment

Comments

Projects
None yet
4 participants
@AxbB36
Copy link

commented Dec 31, 2018

What version of Go are you using (go version)?

$ go version
go version go1.7.4 linux/amd64

Does this issue reproduce with the latest release?

The latest release of go: no.
The latest release of x/mobile: yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/go"
GORACE=""
GOROOT="/usr/lib/go-1.7"
GOTOOLDIR="/usr/lib/go-1.7/pkg/tool/linux_amd64"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build021626937=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"

What did you do?

I was following the instructions at https://github.com/golang/go/wiki/Mobile#sdk-applications-and-generating-bindings.

I'm using Go 1.7.4. gomobile says that it requires Go 1.7+:

$ gomobile
Gomobile is a tool for building and running mobile apps written in Go.

To install:
        
        $ go get golang.org/x/mobile/cmd/gomobile
        $ gomobile init

At least Go 1.7 is required.

I got as far as the gomobile bind command.

$ gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello

What did you expect to see?

$ gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello

(no error)

What did you see instead?

A segmentation fault:

$ gomobile bind -o app/hello.aar -target=android golang.org/x/mobile/example/bind/hello
gomobile: /home/user/go/bin/gobind -lang=go,java -outdir=/tmp/gomobile-work-966862185 golang.org/x/mobile/example/bind/hello failed: exit status 2
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x4066ec]

goroutine 1 [running]:
panic(0x6e4220, 0xc4200100b0)
        /usr/lib/go-1.7/src/runtime/panic.go:500 +0x1a1
main.run()
        /home/user/go/src/golang.org/x/mobile/cmd/gobind/main.go:145 +0x9ac
main.main()
        /home/user/go/src/golang.org/x/mobile/cmd/gobind/main.go:45 +0x27

Additional information

gobind uses an interface that's only in Go 1.9+. I traced the error to this line added by this commit:

	imp := importer.For("source", nil)

importer.For is returning nil. Support for the "source" argument was added in f81466c. I didn't find the change in the release notes, but git tag --contains f81466ce9c663ddc1d136d2c435c60d988cf316a indicates it was added in go1.9. I tried it again with go1.10.5 and didn't encounter the problem.

@gopherbot

This comment has been minimized.

Copy link

commented Jan 3, 2019

Change https://golang.org/cl/156137 mentions this issue: cmd/gomobile: bump required Go version to 1.10

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