ubuntu 9.04下ndk安裝問題

轉載時請註明出處和作者聯繫方式
文章出處: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

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章