problems with Android NDK-7 and AWK

I am having problems with the latest Android NDK:

ligi@ligid:~$ ndk-build 
/home/ligi/bin/android-ndk/prebuilt/linux-x86/bin/awk: 1: ELF: not found
/home/ligi/bin/android-ndk/prebuilt/linux-x86/bin/awk: 4: Syntax error: word unexpected (expecting ")")
Android NDK: Host 'awk' tool is outdated. Please define HOST_AWK to point to Gawk or Nawk !    
/home/ligi/bin/android-ndk/build/core/ *** Android NDK: Aborting.    .  Stop.

ligi@ligid:~$ `echo $HOST_AWK --v`
GNU Awk 3.1.7

I am on stock ubuntu ant totally out of ideas and good keywords for searches


I also had this issue and found this Japanese site with similar problems:

I hope I puzzled out the Google Translated stuff correctly - in any case, basically in the new NDK install, find this directory:


and rename the file "awk" there to something else like "awk_"

I did this and ndk_build now works for me. If I am reading the make files right there is a file called which replaces your HOST_AWK with the prebuilt value if it finds renaming the awk file there defaults back to your gawk.

Hope that helps


The problem is the executable ndk/prebuild/linux-x86/awk is compiled for x86_64, it's not run in a 32 bit kernel

  1. Update your local awk.
  2. Remove the awk in android-ndk itself.

This should resolve the problem.

Go to your <ndk_dir>\build\core\ and open in a text editor, e.g. notepad

Replace the following line

HOST_AWK := $(wildcard $(HOST_PREBUILT)/awk$(HOST_EXEEXT))


ifeq ($(HOST_OS),cygwin)
      HOST_AWK := $(wildcard $(HOST_PREBUILT)/gawk$(HOST_EXEEXT))
      HOST_AWK := $(wildcard $(HOST_PREBUILT)/awk$(HOST_EXEEXT))

@Tod : Thanks, I used your hint here

That works.

I had the same problem running from eclipse on windows with cygwin and NDK8.

I had to add HOST_AWK as an environment variable under project properties -> c/c++ Build -> Environment with the value /cygdrive/[cygwin installdir]/bin/gawk

(As well as having to set the c/c++ build command to bash -c ndk-build)

I was having a problem with different versions of awk on windows. This change uses the cygwin version of awk from a cygwin console and the prebuilt version from a dos console.

Add to

ifeq ($(HOST_OS),cygwin)
       HOST_AWK := /bin/awk

Need Your Help

Declaring strings public static readonly versus public const versus public static const

c# string

In each project we have there is a file used to store the various SQL statements used in that project. There are a handful of variations on how the class is declared and how the strings are declare...

Obtaining focus on a JPanel

java swing focus jpanel

I have a JPanel inside a JFrame. I have registered a KeyListener, based on which I want to update the JPanel. The problem I am having is that I cannot get the focus on the JPanel and therefore my