Android NDK Cygwin make error 127

I have three computers with the Android NDK environment configured identically, according to these instructions.
On one of them, when I start the Cygwin shell to build my project with “ndk-build” I get make error 127:
android_ndk_make_error_127
The other two computers work just fine and compiles the JNI code as expected.

To see more details, retry the build, using:

ndk-build NDK_LOG=1 V=1

I now see the build fails at the arm-eabi-gcc:

me@basic ~
# ndk-build NDK_LOG=1 V=1
Android NDK: NDK installation path auto-detected: '/cygdrive/d/work_code/android
/android-ndk-r4b'
Android NDK: GNU Make version 3.81 detected
Android NDK: Host OS was auto-detected: windows
Android NDK: Host CPU was auto-detected: x86
Android NDK: HOST_TAG set to windows
Android NDK: Host awk tool was auto-detected: awk
Android NDK: Host awk test returned: Pass
Android NDK:  This NDK supports the following toolchains and target ABIs:
Android NDK:    arm-eabi-4.2.1:  armeabi
Android NDK:    arm-eabi-4.4.0:  armeabi armeabi-v7a
Android NDK:    x86-4.2.1:  x86
Android NDK: Found supported platforms: android-3 android-4 android-5 android-8
Android NDK: PLATFORM android-3 supports: arm
Android NDK:   ABI arm sysroot is: /cygdrive/d/work_code/android/android-ndk-r4b
/build/platforms/android-3/arch-arm
Android NDK: PLATFORM android-4 supports: arm
Android NDK:   ABI arm sysroot is: /cygdrive/d/work_code/android/android-ndk-r4b
/build/platforms/android-4/arch-arm
Android NDK: PLATFORM android-5 supports: arm x86
Android NDK:   ABI arm sysroot is: /cygdrive/d/work_code/android/android-ndk-r4b
/build/platforms/android-5/arch-arm
Android NDK:   ABI x86 sysroot is: /cygdrive/d/work_code/android/android-ndk-r4b
/build/platforms/android-5/arch-x86
Android NDK: PLATFORM android-8 supports: arm x86
Android NDK:   ABI arm sysroot is: /cygdrive/d/work_code/android/android-ndk-r4b
/build/platforms/android-8/arch-arm
Android NDK:   ABI x86 sysroot is: /cygdrive/d/work_code/android/android-ndk-r4b
#
Android NDK: Found stable platform levels: 3 4 5 8
Android NDK: Found max platform level: 8
Android NDK: Found project path: /cygdrive/d/work_code/android/JNIProiect
Android NDK: Parsing /cygdrive/d/work_code/android/android-ndk-r4b/build/core/de
fault-application.mk
Android NDK:   Found APP_PLATFORM=android-7 in /cygdrive/d/work_code/android/Blu
eInput/default.properties
Android NDK:   Adjusting APP_PLATFORM to android-5
Android NDK:   Using build script /cygdrive/d/work_code/android/JNIProiect/jni/An
droid.mk
Android NDK: Application 'local' is not debuggable
Android NDK: Selecting release optimization mode (app is not debuggable)
Android NDK: Building application 'local' for ABI 'armeabi'
Android NDK: Using target toolchain 'arm-eabi-4.4.0' for 'armeabi' ABI
rm -f /cygdrive/d/work_code/android/JNIProiect/libs/armeabi/lib*.so /cygdrive/d/w
ork_code/android/JNIProiect/libs/armeabi-v7a/lib*.so /cygdrive/d/work_code/androi
d/JNIProiect/libs/x86/lib*.so
rm -f /cygdrive/d/work_code/android/JNIProiect/libs/armeabi/gdbserver /cygdrive/d
/work_code/android/JNIProiect/libs/armeabi-v7a/gdbserver /cygdrive/d/work_code/an
droid/JNIProiect/libs/x86/gdbserver
rm -f /cygdrive/d/work_code/android/JNIProiect/libs/armeabi/gdb.setup /cygdrive/d
/work_code/android/JNIProiect/libs/armeabi-v7a/gdb.setup /cygdrive/d/work_code/an
droid/JNIProiect/libs/x86/gdb.setup
Compile thumb  : JNIProiect <= /cygdrive/d/work_code/android/JNIProiect/jni/BlueIn
put.c
/cygdrive/d/work_code/android/android-ndk-r4b/build/prebuilt/windows/arm-eabi-4.
4.0/bin/arm-eabi-gcc -I/cygdrive/d/work_code/android/android-ndk-r4b/build/platf
orms/android-5/arch-arm/usr/include -fpic -mthumb-interwork -ffunction-sections
-funwind-tables -fstack-protector -fno-short-enums -D__ARM_ARCH_5__ -D__ARM_ARCH
_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__  -Wno-psabi -march=armv5te -mtune=xsc
ale -msoft-float -mthumb -Os -fomit-frame-pointer -fno-strict-aliasing -finline-
limit=64  -I/cygdrive/d/work_code/android/JNIProiect/jni -DANDROID  -Wa,--noexecs
tack -O2 -DNDEBUG -g -c -MMD -MP -MF /cygdrive/d/work_code/android/JNIProiect/obj
/local/armeabi/objs/JNIProiect/JNIProiect.o.d /cygdrive/d/work_code/android/BlueIn
put/jni/JNIProiect.c -o /cygdrive/d/work_code/android/JNIProiect/obj/local/armeabi
/objs/JNIProiect/JNIProiect.o
make: *** [/cygdrive/d/work_code/android/JNIProiect/obj/local/armeabi/objs/BlueIn
put/JNIProiect.o] Error 127

me@basic ~
#

Manually opening arm-eabi-gcc.exe in d:\work_code\android\android-ndk-r4b\build\prebuilt\windows\arm-eabi-4.4.0\bin\ fails with "The procedure entry point __ctype_ptr__could not be located in the dynamic link library cygwin1.dll." :
arm-eabi-gcc-error
In this case the problem is that cygwin1.dll located in the cygwin installation folder was not found. To fix this add the cygwin/bin folder to your system's environment path variable:
cywin_path

This still doesn't help, I get error 127 again. Copying the cygwin1.dll where the arm-eabi-gcc.exe is, seems to help but running the build script again results in Error 1. So this is not a solution.

A quick research on the internet shows this is a popular issue. Some say you need to reinstall Cygwin, others blame the NDK package. No use.

If I try to compile a C file to native executable, using the Makefile script presented here, it fails with error 127. I don't have more time to waste on time, but I assume is some kind of conflict with other development tools I have installed on this machine (MS VS, etc).

This machine also fails to connect to the Android properly, via USB, I get lots of timeouts and disconnects on large data volume. I've presented that issue here.

Should you find a solution, let me know.

Leave a Reply