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/build-binary.mk 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:

https://groups.google.com/forum/?fromgroups=#!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/init.mk: 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.

5 COMMENTS

  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!

  2. […] http://developer.appcelerator.com/blog/2013/03/correcting-a-bug-in-the-latest-google-ndk-r8e.html 相关文章2013年04月24日 — cocos2d-x创建android项目后NDK编译警告被当作错误的处理方法 (0)2011年09月17日 — Android真机执行ndk-gdb后出现”found running pid:0 could not extract pid of application…”的解决方法 (0)2011年09月17日 — NDK r6编译一直提示WARNING: Rebuilding STLport libraries from sources! 的不确定解决方法 (0)2013年03月13日 — 对于Android NDK编译器ARM和Thumb模式的理解及Toolchain的切换clang编译器 (1)2013年03月14日 — 使用distcc分布式编译加速Android NDK原生项目编译生成 (0)Zemanta […]

Comments are closed.