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

misc/android: document the standalone NDK toolchain #14398

Closed
rakyll opened this issue Feb 19, 2016 · 5 comments
Closed

misc/android: document the standalone NDK toolchain #14398

rakyll opened this issue Feb 19, 2016 · 5 comments

Comments

@rakyll
Copy link
Contributor

rakyll commented Feb 19, 2016

I don't remember having to set the sysroot with arm-linux-androideabi-gcc before.

/cc @crawshaw

$ arm-linux-androideabi-gcc --version
arm-linux-androideabi-gcc (GCC) 4.8
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ CC_FOR_TARGET=arm-linux-androideabi-gcc CXX_FOR_TARGET=arm-linux-androideabi-gcc  GOARCH=arm GOARM=7 ./androidtest.bash

# ...
##### Building packages and commands for android/amd64.
runtime/internal/sys
runtime/internal/atomic
runtime
errors
internal/race
sync/atomic
unicode
unicode/utf8
math
sort
container/list
container/ring
crypto/subtle
sync
runtime/cgo
encoding
unicode/utf16
image/color
runtime/race
cmd/vet/internal/whitelist
container/heap
io
syscall
internal/singleflight
image/color/palette
hash
crypto/cipher
runtime/trace
# runtime/cgo
runtime/cgo/gcc_android.c:8:10: fatal error: 'android/log.h' file not found
hash/adler32
hash/crc32
crypto/hmac
@hyangah
Copy link
Contributor

hyangah commented Feb 19, 2016

Are you using a stand-alone ndk toolchain?

In builder, we use a stand-alone ndk toolchain prepared with make-standalone-toolchain.sh which sets up all the include files and libraries in usual places. http://developer.android.com/ndk/guides/standalone_toolchain.html

Otherwise, wrap the gcc command with --sysroot and set CC to be the wrapper.

@hyangah
Copy link
Contributor

hyangah commented Feb 19, 2016

I mean CC_FOR_TARGET

@rakyll
Copy link
Contributor Author

rakyll commented Feb 19, 2016

I will update the docs about building the standalone toolchain.

@rakyll rakyll changed the title misc: androidtest.bash is failing build: androidtest.bash is failing Feb 19, 2016
@rakyll rakyll changed the title build: androidtest.bash is failing misc/android: document standalone toolchain Feb 19, 2016
@rakyll rakyll added this to the Unreleased milestone Feb 19, 2016
@rakyll rakyll changed the title misc/android: document standalone toolchain misc/android: document the standalone NDK toolchain Feb 19, 2016
@dr2chase
Copy link
Contributor

Still needs documentation or self-diagnosis or something. On a Mac, it fails like so:

~/GoogleDrive/work/go/src$ ./androidtest.bash 
GOARCH must be set
~/GoogleDrive/work/go/src$ GOARCH=arm64 ./androidtest.bash 
##### Building Go bootstrap tool.
cmd/dist
...
# runtime/cgo
runtime/cgo/gcc_android.c:6:10: fatal error: 'android/log.h' file not found

and then many repetitions of

warning: unable to find runtime/cgo.a
/Users/drchase/GoogleDrive/work/go/pkg/tool/darwin_amd64/link: running clang failed: exit status 1
ld: unknown option: -z
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I had related unhappiness trying to bootstrap.bash on a Linux box; no problems with linker flags, but could not find runtime/cgo.a.

@eliasnaur
Copy link
Contributor

I believe this is now covered by misc/android/README. In particular, androidtest.bash is now gone and standalone toolchains are no longer required; recent NDKs include toolchains ready to use.

@golang golang locked and limited conversation to collaborators Mar 7, 2020
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