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
Closed

x/mobile: claims to require 1.7+ but actually requires 1.9+ #29486

AxbB36 opened this issue Dec 31, 2018 · 1 comment
Labels
Documentation FrozenDueToAge mobile Android, iOS, and x/mobile NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@AxbB36
Copy link

AxbB36 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 gopherbot added this to the Unreleased milestone Dec 31, 2018
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Dec 31, 2018
@bradfitz bradfitz added Documentation NeedsFix The path to resolution is known, but the work has not been done. labels Jan 2, 2019
@gopherbot
Copy link

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

@golang golang locked and limited conversation to collaborators Jan 3, 2020
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
Go 1.9 is probably enough, but I'm not willing to support it.

Fixes golang/go#29486

Change-Id: I6dac22dbbd527d6668c5951d9060617efb758b96
Reviewed-on: https://go-review.googlesource.com/c/156137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
Go 1.9 is probably enough, but I'm not willing to support it.

Fixes golang/go#29486

Change-Id: I6dac22dbbd527d6668c5951d9060617efb758b96
Reviewed-on: https://go-review.googlesource.com/c/156137
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Documentation FrozenDueToAge 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

4 participants