ubuntu 9.04下ndk安装问题

来源:互联网 发布:帮客创投网络借贷 编辑:程序博客网 时间:2024/05/01 13:32

转载时请注明出处和作者联系方式
文章出处:http://blog.csdn.com/keensword007
作者联系方式:琴剑 <keensword007 at sina dot com>    

 

从android网站下载ndk-1.6后,执行设置脚本后,出现如下错误:

 

 

chenzhengyong@chenzhengyong-laptop:~/workspace/android/android-ndk-1.6_r1$ ./build/host-setup.sh 

Checking host development environment.

NDK Root   : /home/chenzhengyong/workspace/android/android-ndk-1.6_r1

GNU Make   : make (version 3.81)

[: 205: Pass: unexpected operator

[: 205: Pass: unexpected operator

[: 205: Pass: unexpected operator

ERROR: Could not find a valid Nawk or Gawk executable.

       Please ensure that either one of them is installed.

       Use the --no-awk-check option to ignore this message.

开始还以为是gawk没有安装,确认gawk已经安装后,执行host-setup.sh脚本,仍然提示以上错误。
借助于互联网,找到了一下解决方法:

将host-setup.sh脚本第119行由 
    if [ "$result" == "Pass" ] ; then 

改成
    if [ "$result" = "Pass" ] ; then 

 

再执行,就不会有问题了。

 

为什么会出现这种错误呢,翻看了一下bash shell编程资料,=和==应该是等价的。但是我使用的ubuntu 9.04版本/bin/sh却是链到dash,因此另一个解决方法是修改第一行,将

    #!/bin/sh

改成

    #!/bin/bash

 

dash全称为Debian Almquist shell,它比bash小得多,速度快,但功能有所缩减。现在大部分脚本都是bash脚本,所以一劳永逸的做法是:

    sudo rm /bin/sh

    sudo ln -s bash /bin/sh

 

 

原创粉丝点击