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: gomobile +6d0d39b incompatible with NDK 20.0.x #35030

Open
archanpaul opened this issue Oct 21, 2019 · 10 comments
Open

x/mobile: gomobile +6d0d39b incompatible with NDK 20.0.x #35030

archanpaul opened this issue Oct 21, 2019 · 10 comments
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@archanpaul
Copy link

archanpaul commented Oct 21, 2019

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

$ go version
gomobile version +6d0d39b Wed Oct 2 17:59:09 2019 +0000 (android); androidSDK=/opt/android-sdk/platforms/android-29

Does this issue reproduce with the latest release?

Yes.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/arp/.cache/go-build"
GOENV="/home/arp/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/opt/go-packages"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build030033936=/tmp/go-build -gno-record-gcc-switches"

What did you do?

gomobile clean
gomobile init

What did you expect to see?

Should not show following error!!

What did you see instead?

gomobile: No compiler for 386 was found in the NDK (tried /opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android16-clang). Make sure your NDK version is >= r19c. Use `sdkmanager --update` to update it.

gomobile bind
gomobile: No compiler for amd64 was found in the NDK (tried /opt/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang). Make sure your NDK version is >= r19c. Use `sdkmanager --update` to update it.

Android NDK version

Android NDK r20.0.x

@gopherbot gopherbot added this to the Unreleased milestone Oct 21, 2019
@gopherbot gopherbot added the mobile Android, iOS, and x/mobile label Oct 21, 2019
@archanpaul
Copy link
Author

For those who are facing the incompatibility problem, here is a temporary hack to use NDK r19.2.x :

  1. Install NDK r19.2.x in the side of R20.0.x
  2. cd $SDK_FOLDER
  3. ln -s ndk/19.2.5345600 ndk-bundle

gomobile init should work with this hack!!

@bcmills
Copy link
Contributor

bcmills commented Oct 21, 2019

CC @hyangah @steeve

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Oct 21, 2019
@steeve
Copy link
Contributor

steeve commented Oct 21, 2019

Not sure about that one, sorry. We are running gobind inside bazel, and didn't get any particular issues with r20. I may have read that the layout changed quite a bit though...

@LasTshaMAN
Copy link

Still happens today:

lastshaman@LasTshaMAN:~/my-project$ gomobile init
gomobile: No compiler for arm was found in the NDK (tried /home/lastshaman/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi16-clang). Make sure your NDK version is >= r19c. Use `sdkmanager --update` to update it.

@archanpaul workaround from above helps though.

@vikulin
Copy link

vikulin commented Jun 9, 2020

any updates?

@vikulin
Copy link

vikulin commented Jun 9, 2020

Reproduced for go v 1.14

@vikulin
Copy link

vikulin commented Jun 9, 2020

  1. Android SDK does not use ndk-bundle path but ndk:
    ~/Android/Sdk/ndk
  2. Subpath for toochains is also different:
    ~/Android/Sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/linux-x86_64/bin

vadym@ubuntu:~/Android/Sdk/ndk/21.2.6472646/toolchains/llvm/prebuilt/linux-x86_64/bin$ ls aarch64-linux-android21-clang armv7a-linux-androideabi23-clang ld.lld aarch64-linux-android21-clang++ armv7a-linux-androideabi23-clang++ lldb-argdumper aarch64-linux-android22-clang armv7a-linux-androideabi24-clang llvm-addr2line aarch64-linux-android22-clang++ armv7a-linux-androideabi24-clang++ llvm-ar aarch64-linux-android23-clang armv7a-linux-androideabi26-clang llvm-as aarch64-linux-android23-clang++ armv7a-linux-androideabi26-clang++ llvm-cfi-verify aarch64-linux-android24-clang armv7a-linux-androideabi27-clang llvm-config aarch64-linux-android24-clang++ armv7a-linux-androideabi27-clang++ llvm-cov aarch64-linux-android26-clang armv7a-linux-androideabi28-clang llvm-dis aarch64-linux-android26-clang++ armv7a-linux-androideabi28-clang++ llvm-lib aarch64-linux-android27-clang armv7a-linux-androideabi29-clang llvm-link aarch64-linux-android27-clang++ armv7a-linux-androideabi29-clang++ llvm-modextract aarch64-linux-android28-clang bisect_driver.py llvm-nm aarch64-linux-android28-clang++ clang llvm-objcopy aarch64-linux-android29-clang clang++ llvm-objdump aarch64-linux-android29-clang++ clang-check llvm-profdata aarch64-linux-android-addr2line clang-cl llvm-ranlib aarch64-linux-android-ar clang-format llvm-readelf aarch64-linux-android-as clang-tidy llvm-readobj aarch64-linux-android-c++filt clang-tidy.real llvm-size aarch64-linux-android-dwp dsymutil llvm-strings aarch64-linux-android-elfedit git-clang-format llvm-strip aarch64-linux-android-gprof i686-linux-android16-clang llvm-symbolizer aarch64-linux-android-ld i686-linux-android16-clang++ sancov aarch64-linux-android-ld.bfd i686-linux-android17-clang sanstats aarch64-linux-android-ld.gold i686-linux-android17-clang++ scan-build aarch64-linux-android-nm i686-linux-android18-clang scan-view aarch64-linux-android-objcopy i686-linux-android18-clang++ x86_64-linux-android21-clang aarch64-linux-android-objdump i686-linux-android19-clang x86_64-linux-android21-clang++ aarch64-linux-android-ranlib i686-linux-android19-clang++ x86_64-linux-android22-clang aarch64-linux-android-readelf i686-linux-android21-clang x86_64-linux-android22-clang++ aarch64-linux-android-size i686-linux-android21-clang++ x86_64-linux-android23-clang aarch64-linux-android-strings i686-linux-android22-clang x86_64-linux-android23-clang++ aarch64-linux-android-strip i686-linux-android22-clang++ x86_64-linux-android24-clang arm-linux-androideabi-addr2line i686-linux-android23-clang x86_64-linux-android24-clang++ arm-linux-androideabi-ar i686-linux-android23-clang++ x86_64-linux-android26-clang arm-linux-androideabi-as i686-linux-android24-clang x86_64-linux-android26-clang++ arm-linux-androideabi-c++filt i686-linux-android24-clang++ x86_64-linux-android27-clang arm-linux-androideabi-dwp i686-linux-android26-clang x86_64-linux-android27-clang++ arm-linux-androideabi-elfedit i686-linux-android26-clang++ x86_64-linux-android28-clang arm-linux-androideabi-gprof i686-linux-android27-clang x86_64-linux-android28-clang++ arm-linux-androideabi-ld i686-linux-android27-clang++ x86_64-linux-android29-clang arm-linux-androideabi-ld.bfd i686-linux-android28-clang x86_64-linux-android29-clang++ arm-linux-androideabi-ld.gold i686-linux-android28-clang++ x86_64-linux-android-addr2line arm-linux-androideabi-nm i686-linux-android29-clang x86_64-linux-android-ar arm-linux-androideabi-objcopy i686-linux-android29-clang++ x86_64-linux-android-as arm-linux-androideabi-objdump i686-linux-android-addr2line x86_64-linux-android-c++filt arm-linux-androideabi-ranlib i686-linux-android-ar x86_64-linux-android-dwp arm-linux-androideabi-readelf i686-linux-android-as x86_64-linux-android-elfedit arm-linux-androideabi-size i686-linux-android-c++filt x86_64-linux-android-gprof arm-linux-androideabi-strings i686-linux-android-dwp x86_64-linux-android-ld arm-linux-androideabi-strip i686-linux-android-elfedit x86_64-linux-android-ld.bfd armv7a-linux-androideabi16-clang i686-linux-android-gprof x86_64-linux-android-ld.gold armv7a-linux-androideabi16-clang++ i686-linux-android-ld x86_64-linux-android-nm armv7a-linux-androideabi17-clang i686-linux-android-ld.bfd x86_64-linux-android-objcopy armv7a-linux-androideabi17-clang++ i686-linux-android-ld.gold x86_64-linux-android-objdump armv7a-linux-androideabi18-clang i686-linux-android-nm x86_64-linux-android-ranlib armv7a-linux-androideabi18-clang++ i686-linux-android-objcopy x86_64-linux-android-readelf armv7a-linux-androideabi19-clang i686-linux-android-objdump x86_64-linux-android-size armv7a-linux-androideabi19-clang++ i686-linux-android-ranlib x86_64-linux-android-strings armv7a-linux-androideabi21-clang i686-linux-android-readelf x86_64-linux-android-strip armv7a-linux-androideabi21-clang++ i686-linux-android-size yasm armv7a-linux-androideabi22-clang i686-linux-android-strings armv7a-linux-androideabi22-clang++ i686-linux-android-strip

@vikulin
Copy link

vikulin commented Jun 9, 2020

For those who are facing the incompatibility problem, here is a temporary hack to use NDK r19.2.x :

1. Install NDK r19.2.x in the side of R20.0.x

2. cd $SDK_FOLDER

3. ln -s ndk/19.2.5345600 ndk-bundle

gomobile init should work with this hack!!

You don't need to install r19 ndk: just run
vadym@ubuntu:~/Android/Sdk$ ln -s ndk/21.2.6472646/ ndk-bundle

Thanks

@yingshaoxo
Copy link

add the following to your ~/.bashrc:

export ANDROID_HOME=$HOME/Android/Sdk
export ANDROID_NDK_HOME=$ANDROID_HOME/ndk/21.3.6528147
export PATH=$PATH:$GOPATH/bin:$ANDROID_HOME/platform-tools/

As I can see, you guys just have to specify the ndk version clearly.

@mjolk
Copy link

mjolk commented Feb 1, 2022

fyi when using ndk 24+ i got it working by creating symbolic links armv7a-linux-androideabi32 -> armv7a-linux-androideabi16 same for i686, gomobile is looking for androideabi16 but this isn't present anymore in the latest ndk's, you can link whatever versions you want, it compiles to .aar (using gomobile bind) but when typing this I haven't thoroughly checked if everything is working.

edit: even if you just want android/arm64 the gomobile toolchain still dies if it can't find these compilers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mobile Android, iOS, and x/mobile NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

8 participants