Search code examples
androidandroid-ndkcygwin

build error: no toolchain with host-setup.sh ndk-r3 with cygwin 1.7.35


I am trying to run

$ ./build/host-setup.sh 

but it throws the following error

./build/core/ndk-common.sh: line 44: [: too many arguments
./build/core/ndk-common.sh: line 49: [: too many arguments
Checking host development environment.
NDK Root   : /home/NITISH NIHAR DORA/android-ndk-r3
GNU Make   : make (version 4.1)
Awk        : awk
Platform   : windows
Generate   : out/host/config.mk
Toolchain  : Checking for arm-eabi-4.2.1 prebuilt binaries

ERROR: Toolchain compiler not found
It seems you do not have the correct arm-eabi-4.2.1 toolchain binaries.
This may be the result of incorrect unzipping of the NDK archive.
Please go to the official Android NDK web site and download the
appropriate NDK package for your platform (windows).
See http://developer.android.com/sdk/index.html

ABORTING.

I looked everywhere but there is no satisfactory answer available.How should I modify the .bashrc or the host-setup.sh file to build it successfully


Solution

  • It's hard to believe you really must use NDK r.3 in 2015. Lots of weird bugs have been fixed since then, and lots of improvements have been introduced, including standalone toolchain handling. Note that cygwin is not required by NDK anymore, but need some bash to use standalone toolchain. I prefer MinGW, but cygwin also does the job. Make sure to only use paths "mixed style", e.g.

    d:/workspace/MyProject/jni/my_main.cpp
    

    and neither

    /cygdrive/d/workspace/MyProject/jni/my_main.cpp
    

    nor

    d:\workspace\MyProject\jni\my_main.cpp
    

    will do.

    But even today NDK does not handle directory names that have spaces correctly. So, probably your immediate problem will resolve if you simply move your NDK to D:\Android\NDK directory.