Correcting a Bug in the Latest Google NDK r8e

3d abstract architecture background

In our continuing effort to inform you of ecosystem issues as we encounter them, the latest NDK toolchain update from Google contains a bug. This causes an issue when building the Titanium Mobile SDK from source. The fix is trivial, and is only necessary if you’ve updated to NDK version r8e, released March 21st, 2013 and are building Titanium Mobile using SCons.

To perform the fix, edit the file build/core/ under the Android NDK directory, replacing line 49:

$(cleantarget): PRIVATE_CLEAN_FILES := ($(my)OBJS)
With this:
$(cleantarget): PRIVATE_CLEAN_FILES := $($(my)OBJS)

The following output from “scons android” (when building titatitanium_mobile) is a symptom of the problem:
     [exec] rm -f src/native/../../generated/*
     [exec] rm -rf src/native/../../obj/*
     [exec] Clean: kroll-v8 [armeabi]
     [exec] rm -rf (TARGET_OBJS)
     [exec] /bin/sh: -c: line 0: syntax error near unexpected token `(‘
     [exec] /bin/sh: -c: line 0: `rm -rf (TARGET_OBJS)’
     [exec] make: *** [clean-kroll-v8-armeabi] Error 2

More information can be found here:!topic/android-ndk/3wIbb-h3nDU
There is a second issue that only affects Max OS X developers using the 64-bit NDK (i.e. the download with the file name android-ndk-r8e-darwin-x86_64.tar.bz2). The fix is trivial and requires you to make the following one-line changes to these two files:
${ANDROID_NDK}/ndk-build: Replace line 158:

file -L “$SHELL” | grep -q “x86[_-]64”

with this:

file -L “$SHELL” | grep -q “[xX]86[_-]64”

${ANDROID_NDK}/build/core/ Replace line 229:

ifneq (,$(shell file -L $(SHELL) | grep ‘x86[_-]64’))

with this:

ifneq (,$(shell file -L $(SHELL) | grep ‘[xX]86[_-]64’))

As a note, you should be using the 64-bit NDK if your system supports it, since you will get 30% faster builds. The 64-bit tools utilize host resources better (faster, handle larger programs, etc) and they should function identically to their 32-bit counterparts, i.e. 64-bit toolchains still generate 32-bit binaries for Android.

This issue will be fixed by Google in the next release of the NDK. We will update this post with any new information we receive.
Previous articleAppcelerator Titanium: Patterns & Best Practices (Book)
Next article6 Ways Enterprise Software Completely Changes in the New World of SaaS
VP, Architecture - Senior executive, manager, and architect with 25+ years of experience leading a variety of mobile, cloud, SaaS, web-based and desktop software technologies used by over 5 million developers and tens of thousands of enterprise customers.


  1. With every NDK there is a bug that can potentially create disaster for companies relying on google tools.
    We build debug/release builds and because of badly glued tools we have to ndk-build clean before switching to release builds. With this bug wrong builds slipped into our release.
    Can I get address of the person responsible? I’d like to send flowers with a courier.
    Seriously WTF?! just take down existing packages, apply that fix and re-upload fixed istead of putting those unaware into such position!


Please enter your comment!
Please enter your name here