开发者

hello-jni NDK sample - ndk-build fails

I am following the steps on http://developer.android.com/sdk/ndk/overview.html to build the hello-jni sample, however when I get to Step 2 to run

cd $NDK-ROOT/samples/hello-jni
$NDK-ROOT/ndk-build

in the Cygwin command prompt, I receive the following error messages:

/bin/sh: -c: line 0: unexpected EOF while looking for matching `''
/bin/sh: -c: line 1: syntax error: unexpected end of file
Android NDK: Host awk tool is outdated. Please define HOST_AWK to point to Gawk
or Nawk !

I have Cygwin 1.7.9, Gnu Make 3.8.2, and Gawk 3.1.8 on my Windows machine, along with the r5b release of the Android NDK. I also have set the HOST_AWK environment variable, which points to my Gawk folder.

Unfortunatley the sample cannot run successfully without this step, (if I run hello开发者_运维知识库-jni, I immediately receive an UnsatisfiedLinkError exception).

Below is the portion of the init.mk file on my machine (found in NDK_ROOT/build/core) which creates this error:

# Location of all awk scripts we use
BUILD_AWK := $(NDK_ROOT)/build/awk

AWK_TEST := $(shell $(HOST_AWK) -f $(BUILD_AWK)/check-awk.awk)
$(call ndk_log,Host awk test returned: $(AWK_TEST))
ifneq ($(AWK_TEST),Pass)
$(call __ndk_info,Host awk tool is outdated. Please define HOST_AWK to point to Gawk or     Nawk !)
$(call __ndk_error,Aborting.)
endif

Thank-you for your help


Try updating your awk tool. Seems to an an outdated version (perhaps). Also ensure that NDK root is defined to where you have your NDK source and ensure that your awk tool is located in the build directory of your NDK Source.

NDK_ROOT

Try settings this environment variable to where your NDK root is. Whenever this is defined (Typically at the top)


Instead of HOST_AWK=gawk.exe, just do HOST_AWK=gawk


It turns out there was an apostrophe in my HOST_AWK path, which was causing the problem.


reference https://stackoverflow.com/q/8121153/411522

mine worked fine now.what to do is: just rename the prebuilt awk in ndk

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜