Wednesday, February 22, 2012

solve "Host 'awk' tool is outdated." problem for ndk

While using ndk-build command in ndk r7 to build a project on 32-bit ubuntu, I got this error:
Android NDK: Host 'awk' tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !

It didn't work even if I add the HOST_AWK environment variable and point it to gawk.
There are two reasons:
  1. The prebuilt awk tool comes with ndk r7 is compiled for 64bit and can't run on 32bit os
  2. The HOST_AWK environment variable is overridden by {ndk_root}/build/core/ to point to the prebuilt awk comes with ndk

To solve this problem, remove {ndk_root}/prebuilt/linux-x86/bin/awk. Now the ndk-build script will use correct awk tool.