Skip to content

command not found: gomobile #21818

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

Closed
Pixdigit opened this issue Sep 9, 2017 · 14 comments
Closed

command not found: gomobile #21818

Pixdigit opened this issue Sep 9, 2017 · 14 comments

Comments

@Pixdigit
Copy link

Pixdigit commented Sep 9, 2017

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

go version go1.8.3 linux/amd64

Does this issue reproduce with the latest release?

Afaik that is the latest release

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

go env

What did you do?

The official way to install go and then:
go get golang.org/x/mobile/cmd/gomobile
A restart of my computer just to be sure

What did you expect to see?

I expect to be able to execute gomobile init

What did you see instead?

Neither Bash nor Zsh could find/execute gomobile

@cznic
Copy link
Contributor

cznic commented Sep 9, 2017

The docs are wrong. The correct installation command needs a /... suffix added.

@Pixdigit
Copy link
Author

Pixdigit commented Sep 9, 2017

I tried go get golang.org/x/mobile/cmd/gomobile/... but it did not resolve the issue

@cznic
Copy link
Contributor

cznic commented Sep 9, 2017

jnml@4670:~$ go get golang.org/x/mobile/cmd/gomobile/...
jnml@4670:~$ 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.
For detailed instructions, see https://golang.org/wiki/Mobile.

Usage:

	gomobile command [arguments]

Commands:

	bind        build a library for Android and iOS
	build       compile android APK and iOS app
	clean       remove object files and cached gomobile files
	init        install mobile compiler toolchain
	install     compile android APK and install on device
	version     print version

Use 'gomobile help [command]' for more information about that command.
jnml@4670:~$ 

@Pixdigit
Copy link
Author

Pixdigit commented Sep 9, 2017

➜  mobile git:(master) go get golang.org/x/mobile/cmd/gomobile/...
➜  mobile git:(master) gomobile
zsh: command not found: gomobile

@cznic
Copy link
Contributor

cznic commented Sep 9, 2017

Check the output of go get -x golang.org/x/mobile/cmd/gomobile/... and lookup where the command is installed. I guess the location simply isn't it your $PATH.

@Pixdigit
Copy link
Author

Pixdigit commented Sep 9, 2017

WORK=/tmp/go-build907776089
But why is it set to /tmp ?
I followed the official install guide and did not change anything in regard to $PATH

@cznic
Copy link
Contributor

cznic commented Sep 9, 2017

That's okay. Somewhere later you should see the gomobile binary being installed in the real target.

jnml@4670:~$ go get -x golang.org/x/mobile/cmd/gomobile/... |& tee log
cd .
git clone https://go.googlesource.com/mobile /home/jnml/src/golang.org/x/mobile
cd /home/jnml/src/golang.org/x/mobile
git submodule update --init --recursive
cd /home/jnml/src/golang.org/x/mobile
git show-ref
cd /home/jnml/src/golang.org/x/mobile
git submodule update --init --recursive
WORK=/tmp/go-build091402936
mkdir -p $WORK/golang.org/x/mobile/internal/importers/_obj/
mkdir -p $WORK/golang.org/x/mobile/internal/
cd /home/jnml/src/golang.org/x/mobile/internal/importers
/home/jnml/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/internal/importers.a -trimpath $WORK -goversion go1.9 -p golang.org/x/mobile/internal/importers -complete -buildid 10ad5176a886be7a0cf5f1013b22780e89b4b459 -D _/home/jnml/src/golang.org/x/mobile/internal/importers -I $WORK -pack ./ast.go
mkdir -p $WORK/golang.org/x/mobile/internal/binres/_obj/
cd /home/jnml/src/golang.org/x/mobile/internal/binres
/home/jnml/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/internal/binres.a -trimpath $WORK -goversion go1.9 -p golang.org/x/mobile/internal/binres -complete -buildid ef309c4d3750dd0914b540c234032618c9c78f05 -D _/home/jnml/src/golang.org/x/mobile/internal/binres -I $WORK -pack ./arsc.go ./binres.go ./binres_string.go ./node.go ./pool.go ./sdk.go ./table.go
mkdir -p /home/jnml/pkg/linux_amd64/golang.org/x/mobile/internal/
mv $WORK/golang.org/x/mobile/internal/importers.a /home/jnml/pkg/linux_amd64/golang.org/x/mobile/internal/importers.a
mkdir -p $WORK/golang.org/x/mobile/internal/importers/java/_obj/
mkdir -p $WORK/golang.org/x/mobile/internal/importers/
cd /home/jnml/src/golang.org/x/mobile/internal/importers/java
/home/jnml/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/internal/importers/java.a -trimpath $WORK -goversion go1.9 -p golang.org/x/mobile/internal/importers/java -complete -buildid a11cfbbf4ce5e4f3eb2e80c894a477e70bbfb338 -D _/home/jnml/src/golang.org/x/mobile/internal/importers/java -I $WORK -I /home/jnml/pkg/linux_amd64 -pack ./java.go
mkdir -p $WORK/golang.org/x/mobile/internal/importers/objc/_obj/
cd /home/jnml/src/golang.org/x/mobile/internal/importers/objc
/home/jnml/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/internal/importers/objc.a -trimpath $WORK -goversion go1.9 -p golang.org/x/mobile/internal/importers/objc -complete -buildid b5f35612105c5821be22cd9b7ecdb6d6e5e9ffad -D _/home/jnml/src/golang.org/x/mobile/internal/importers/objc -I $WORK -I /home/jnml/pkg/linux_amd64 -pack ./objc.go
mkdir -p /home/jnml/pkg/linux_amd64/golang.org/x/mobile/internal/importers/
mv $WORK/golang.org/x/mobile/internal/importers/objc.a /home/jnml/pkg/linux_amd64/golang.org/x/mobile/internal/importers/objc.a
mv $WORK/golang.org/x/mobile/internal/importers/java.a /home/jnml/pkg/linux_amd64/golang.org/x/mobile/internal/importers/java.a
mkdir -p $WORK/golang.org/x/mobile/bind/_obj/
mkdir -p $WORK/golang.org/x/mobile/
cd /home/jnml/src/golang.org/x/mobile/bind
/home/jnml/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/bind.a -trimpath $WORK -goversion go1.9 -p golang.org/x/mobile/bind -complete -buildid fc5ec3b5ee65fa5a25a57c76e231a3256f16e859 -D _/home/jnml/src/golang.org/x/mobile/bind -I $WORK -I /home/jnml/pkg/linux_amd64 -pack ./bind.go ./gen.go ./genclasses.go ./gengo.go ./genjava.go ./genobjc.go ./genobjcw.go ./printer.go ./types.go
mv $WORK/golang.org/x/mobile/internal/binres.a /home/jnml/pkg/linux_amd64/golang.org/x/mobile/internal/binres.a
mkdir -p /home/jnml/pkg/linux_amd64/golang.org/x/mobile/
mv $WORK/golang.org/x/mobile/bind.a /home/jnml/pkg/linux_amd64/golang.org/x/mobile/bind.a
mkdir -p $WORK/golang.org/x/mobile/cmd/gomobile/_obj/
mkdir -p $WORK/golang.org/x/mobile/cmd/gomobile/_obj/exe/
cd /home/jnml/src/golang.org/x/mobile/cmd/gomobile
/home/jnml/go/pkg/tool/linux_amd64/compile -o $WORK/golang.org/x/mobile/cmd/gomobile.a -trimpath $WORK -goversion go1.9 -p main -complete -buildid 631396958ab6137527f52e627b9e9f9e5ce2b99e -D _/home/jnml/src/golang.org/x/mobile/cmd/gomobile -I $WORK -I /home/jnml/pkg/linux_amd64 -pack ./binary_xml.go ./bind.go ./bind_androidapp.go ./bind_iosapp.go ./build.go ./build_androidapp.go ./build_iosapp.go ./cert.go ./clean.go ./dex.go ./doc.go ./env.go ./init.go ./install.go ./main.go ./manifest.go ./strings_flag.go ./version.go ./writer.go
cd .
/home/jnml/go/pkg/tool/linux_amd64/link -o $WORK/golang.org/x/mobile/cmd/gomobile/_obj/exe/a.out -L $WORK -L /home/jnml/pkg/linux_amd64 -extld=gcc -buildmode=exe -buildid=631396958ab6137527f52e627b9e9f9e5ce2b99e $WORK/golang.org/x/mobile/cmd/gomobile.a
mkdir -p /home/jnml/bin/
mv $WORK/golang.org/x/mobile/cmd/gomobile/_obj/exe/a.out /home/jnml/bin/gomobile
jnml@4670:~$ 

Note the last mv command.

@Pixdigit
Copy link
Author

Pixdigit commented Sep 9, 2017

This is all the command returns for me:

go get -x golang.org/x/mobile/cmd/gomobile/... |& tee log
WORK=/tmp/go-build627258777

@cznic
Copy link
Contributor

cznic commented Sep 9, 2017

Well, it's a bit brutal but try adding -a: go get -x -a golang.org/x/mobile/cmd/gomobile/... |& tee log. Expect a lot of output, still the important mv should be the last one.

@Pixdigit
Copy link
Author

Pixdigit commented Sep 9, 2017

WORK=/tmp/go-build216010727
mkdir -p $WORK/runtime/internal/sys/_obj/
mkdir -p $WORK/runtime/internal/
cd /usr/local/go/src/runtime/internal/sys
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/runtime/internal/sys.a -trimpath $WORK -p
    runtime/internal/sys -+ -complete -buildid 439ec4f16a42c01056ca1c144acbd88e29f9e60f -D
    _/usr/local/go/src/runtime/internal/sys -I $WORK -pack ./arch.go ./arch_amd64.go ./intrinsics.go
    ./stubs.go ./sys.go ./zgoarch_amd64.go ./zgoos_linux.go ./zversion.go
mkdir -p /usr/local/go/pkg/linux_amd64/runtime/internal/
cp $WORK/runtime/internal/sys.a /usr/local/go/pkg/linux_amd64/runtime/internal/sys.a
go install runtime/internal/sys: open /usr/local/go/pkg/linux_amd64/runtime/internal/sys.a: permission denied

I think I found the error…

@Pixdigit
Copy link
Author

Pixdigit commented Sep 9, 2017

But wait. Go is not installed for root so sudo go […] fails because root does not know of go.
@cznic What should I do then?

@ianlancetaylor
Copy link
Contributor

Nothing to do here. Please ask questions on a forum: https://golang.org/wiki/Questions . Thanks.

@V01dZer0
Copy link

export PATH=$PATH:~/go/bin

@burkaslarry
Copy link

Mine still cannot work

@golang golang locked and limited conversation to collaborators Nov 1, 2019
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

6 participants