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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/mobile/cmd/gomobile: init fails with go1.5.x #13246

Closed
BeeAdmin opened this issue Nov 14, 2015 · 6 comments
Closed

x/mobile/cmd/gomobile: init fails with go1.5.x #13246

BeeAdmin opened this issue Nov 14, 2015 · 6 comments

Comments

@BeeAdmin
Copy link

Edit: Sorry, Pressed Publish before writing anything 馃槤

Anyways, today, I got around installing go/mobile, I followed the instructions, called go get ... and dowloaded the basic example, and ran gomobile init, that resulted in an error, as in:

user@Terminal-T61:~/Go/src/terminal/admin/core$ gomobile init
gomobile: go install -p=2 -gcflags=-shared -ldflags=-shared -pkgdir=/home/user/Go/pkg/gomobile/pkg_android_arm std failed: exit status 2
# runtime
flag provided but not defined: -shared
usage: 5g [options] file.go...
/* etc ... */

I don't really know how to fix it, I'm using go1.51 and go env echoes.

GOARCH="386"
GOBIN=""
GOEXE=""
GOHOSTARCH="386"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/user/Go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_386"
GO15VENDOREXPERIMENT=""
CC="gcc"
GOGCCFLAGS="-fPIC -m32 -pthread -fmessage-length=0"
CXX="g++"
CGO_ENABLED="1"

I'm rockin' lubuntu on my old T61
Finally, one last thing.

user@Terminal-T61:~/Go/src/terminal/admin/core$ ls /home/user/Go/pkg/gomobile/ 
android-ndk-r10e  dl
@ianlancetaylor
Copy link
Contributor

I can tell by the error message that the version of go you are using when you run go install is not Go 1.5.1. Check your PATH.

@xuwaters
Copy link

I met the same problem. Modify the source code of gomobile/init.go as following:

//if err := installStd(androidArmEnv, "-gcflags=-shared", "-ldflags=-shared"); err != nil {
if err := installStd(androidArmEnv); err != nil {

Recompile gomobile command and try again.

@BeeAdmin
Copy link
Author

@ianlancetaylor

user@Terminal-T61:~$ go version
go version go1.5.1 linux/386
user@Terminal-T61:~$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/go/bin:/home/user/Go/bin
user@Terminal-T61:~$ echo $GOROOT
/usr/lib/go

@hyangah
Copy link
Contributor

hyangah commented Nov 14, 2015

I will revert https://go-review.googlesource.com/#/c/16912/ for now.

go1.5.1 and tip compilers have different flag sets and I cannot easily tell how to make it work for both go1.5 and tip yet.

https://go.googlesource.com/go/+/go1.5.1/src/cmd/go/build.go#341
vs.
https://go.googlesource.com/go/+/master/src/cmd/go/build.go#350

@hyangah hyangah reopened this Nov 14, 2015
@BeeAdmin
Copy link
Author

@xuwaters suggestion worked for me, i edited gomobile/init.go, then I put in

sudo apt-get install gcc
sudo GOPATH=/home/user/Go go install -a golang.org/x/mobile/cmd/gomobile

And it worked!
Edit: If anyone could edit the title of the issue to fit it better, Ty!

@hyangah hyangah changed the title x/mobile: x/mobile/cmd/gomobile: init fails with go1.5.x Nov 14, 2015
hyangah added a commit to golang/mobile that referenced this issue Nov 14, 2015
This reverts commit b84795b.

See golang/go#13246

Change-Id: Ie8b89a9ac6e5b6906b3a4de21122d694cf7a2d0a
Reviewed-on: https://go-review.googlesource.com/16917
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
@hyangah
Copy link
Contributor

hyangah commented Nov 14, 2015

/cc @crawshaw

@hyangah hyangah closed this as completed Nov 14, 2015
@golang golang locked and limited conversation to collaborators Nov 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants