From 9cba7bc03c0fdba1b8fe7dfd476c2001656dde9e Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Tue, 31 Aug 2021 11:43:10 +0200 Subject: [PATCH] cmd/gomobile: handle NDK path for darwin/arm64 This change allows TestBindAndroid to pass. Fixes golang/go#46464 Change-Id: I8cc3edb21fe9ae9efdc0c8c243a4098553b06e5e Reviewed-on: https://go-review.googlesource.com/c/mobile/+/346153 Reviewed-by: Hajime Hoshi Reviewed-by: Hyang-Ah Hana Kim Run-TryBot: Hajime Hoshi TryBot-Result: Go Bot --- cmd/gomobile/env.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/gomobile/env.go b/cmd/gomobile/env.go index 6dacc63..13b0ab0 100644 --- a/cmd/gomobile/env.go +++ b/cmd/gomobile/env.go @@ -294,6 +294,15 @@ func archNDK() string { arch = "x86" case "amd64": arch = "x86_64" + case "arm64": + // Android NDK does not contain arm64 toolchains (until and + // including NDK 23), use use x86_64 instead. See: + // https://github.com/android/ndk/issues/1299 + if runtime.GOOS == "darwin" { + arch = "x86_64" + break + } + fallthrough default: panic("unsupported GOARCH: " + runtime.GOARCH) }