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: NDK r16 is incompatible #22766

worldiety opened this issue Nov 16, 2017 · 4 comments

x/mobile: NDK r16 is incompatible #22766

worldiety opened this issue Nov 16, 2017 · 4 comments


Copy link

@ghost ghost commented Nov 16, 2017

Please answer these questions before submitting your issue. Thanks!

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

go1.9 darwin/amd64

Does this issue reproduce with the latest release?


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

GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/bv/6rt5ck194ls704dz9p4c0hlh0000gn/T/go-build942922073=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Using goMobile with latest Android NDK r16 is not compatible with current goMobile and causes a build failure.

What did you expect to see?

A successful gomobile build
gomobile bind -target=android -o mylib.aar my/export/package

What did you see instead?

xxx/backend-go/deps/bin/gomobile: go build -pkgdir=xxx/backend-go/deps/pkg/gomobile/pkg_android_arm64 -buildmode=c-shared -o=/tmp/gomobile-work-179627284/android/src/main/jniLibs/arm64-v8a/ /tmp/gomobile-work-179627284/androidlib/main.go failed: exit status 2


seq_android.c:213:3: error: implicitly declaring library function 'memcpy' with type 'void *(void *, const void *, unsigned long)' [-Werror,-Wimplicit-function-declaration]
seq_android.c:213:3: note: include the header <string.h> or explicitly provide a declaration for 'memcpy'


goMobile still works with NDK r15c, so I could imagine that this is caused by "The deprecated headers have been removed. Unified Headers are now simply The Headers."

Changelog for r16:

Migration note for unified headers:

@gopherbot gopherbot added this to the Unreleased milestone Nov 16, 2017
@gopherbot gopherbot added the mobile label Nov 16, 2017

This comment has been minimized.

Copy link

@ivanalejandro0 ivanalejandro0 commented Nov 17, 2017

I experienced (what I think is) the same bug as you describe.

Here's how I workarounded it:
I edited the file and added this line: #include <string.h>
On my setup, the file is here: ~/golang/workspace/src/

I would create a PR, but "Unfortunately, the Go project doesn't use GitHub's Pull Requests" (from here), and the contribution guide is too long for a one line casual contribution, so in case this helps someone, here's the diff:

diff --git a/bind/java/ b/bind/java/
index fbc6d55..7c0f483 100644
--- a/bind/java/
+++ b/bind/java/
@@ -11,6 +11,7 @@
 #include <jni.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <string.h>
 #include <unistd.h>
 #include <pthread.h>
 #include "seq.h"

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 22, 2017

Change mentions this issue: x/mobile: Build on NDK r16


This comment has been minimized.

Copy link

@hajimehoshi hajimehoshi commented Dec 16, 2017

What's going on this? I'd be really happy if the change could be committed soon.


This comment has been minimized.

Copy link

@pnemere pnemere commented Dec 19, 2017

OK so I had the same issue, and editing fixed it for me.

I see this has been merged - when can I expect this to make it onto my machine through a new version of... something?

I've just started using gomobile and am finding nothing but roadblocks - is gradle 4.4/android sdk 27/ supposed to work?

The bind example from the guide is a complete mess with a current version of Android studio or the above items.

I guess it does teach you a lot about go and building stuff, but it doesn't exactly leave a good impression - the reason I went in search of go was compiling my native C++ library with boost and all on 5 platforms (windows, linux, android, ios, osx) is an absolute nightmare...

Surely I'm doing something wrong and go isn't this flakey??

@golang golang locked and limited conversation to collaborators Dec 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.