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/init.mk:258: *** 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

Answers


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

http://d.hatena.ne.jp/yohpapa/20111113/1321198570

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

..../android-ndk-r7/prebuilt/linux-x86/bin

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 init.mk which replaces your HOST_AWK with the prebuilt value if it finds it...so renaming the awk file there defaults back to your gawk.

Hope that helps

Kibi


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 init.mk in a text editor, e.g. notepad

Replace the following line

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

with

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

@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 init.mk:

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

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