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

Comments

Projects
None yet
6 participants
@jcgruenhage
Copy link

commented Jun 22, 2017

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 label Jul 20, 2017

@cosmosgenius

This comment has been minimized.

Copy link

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

This comment has been minimized.

Copy link

commented Jan 2, 2018

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

@cosmosgenius

This comment has been minimized.

Copy link

commented Jan 3, 2018

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

This comment has been minimized.

Copy link
Contributor

commented Mar 16, 2018

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.

@eliasnaur eliasnaur closed this Mar 16, 2018

@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.
You can’t perform that action at this time.