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: Build binaries for android. #20755

Closed
jcgruenhage opened this issue Jun 22, 2017 · 4 comments
Closed

x/mobile: Build binaries for android. #20755

jcgruenhage opened this issue Jun 22, 2017 · 4 comments
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Milestone

Comments

@jcgruenhage
Copy link

It would be nice if we could build executable binaries for android using gomobile.

@gopherbot gopherbot added this to the Unreleased milestone Jun 22, 2017
@bradfitz bradfitz added the mobile Android, iOS, and x/mobile label Jul 20, 2017
@cosmosgenius
Copy link

cosmosgenius commented Dec 31, 2017

Is there any article on how to do this?...I am able to build binary for android by using GOOS=linux GOARCH=arm go build. The binary works, but libc api has problems since the default is to link with glibc i guess and android uses bionic. Is there a way to create a go binary linking to bionic?

@festum
Copy link

festum commented Jan 2, 2018

+1
I'm seeking the way developing on Android too:)

@cosmosgenius
Copy link

Ok sort of figured out...
I am first building the ndk-toolchain using
$(ANDROID_NDK_ROOT)/build/tools/make_standalone_toolchain.py --arch ${ARCH} --api 19 --install-dir ${TOOLCHAIN_DIR}

Then i needed to cross compile the golang std itself.
CC=$(TOOLCHAIN_DIR)/bin/clang CXX=$(TOOLCHAIN_DIR)/bin/clang GOOS=android GOARCH=$(ARCH) go install std

Then build my own tool using.
CC=$(TOOLCHAIN_DIR)/bin/clang CXX=$(TOOLCHAIN_DIR)/bin/clang GOOS=android GOARCH=$(ARCH) go build

for anyone looking to do same for ios.
CC=$(GOROOT)/misc/ios/clangwrap.sh CXX=$(GOROOT)/misc/ios/clangwrap.sh GOOS=darwin GOARCH=arm64 go build

Hope it helps

@eliasnaur
Copy link
Contributor

I'm going to close this. Building regular executables is out of scope for gomobile and can be done by setting up your own toolchains as demonstrated by @cosmosgenius.

@golang golang locked and limited conversation to collaborators Mar 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge mobile Android, iOS, and x/mobile
Projects
None yet
Development

No branches or pull requests

6 participants