如何使用cygwin在Windows上运行.sh文件?

时间:2020-12-02 02:05:47

I am beginner of cygwin terminal. I am trying to run *.sh file on windows 8 using command ./file_name.sh, but it gives error given below....

我是cygwin终端的初学者。我试图使用命令./file_name.sh在Windows 8上运行* .sh文件,但它给出了下面给出的错误....

Using prebuilt externals

使用预建的外部

ERROR: Cannot find 'make' program. Please install Cygwin make package or define the GNUMAKE variable to point to it.

错误:找不到'make'程序。请安装Cygwin make package或定义GNUMAKE变量以指向它。

I have installed cygwin in F drive, I google this error and set the variable path in computer properties > advance system properties > variable environment > path >edit and variable path is ;F:\cygwin\bin But does not work. How can i solve this problem??

我在F盘中安装了cygwin,我谷歌这个错误并在计算机属性中设置变量路径>高级系统属性>变量环境>路径>编辑和变量路径是; F:\ cygwin \ bin但是不起作用。我怎么解决这个问题??

Here is my script

这是我的剧本

`# set params`
NDK_ROOT=/cygdrive/f/Android/android-ndk-r9b
COCOS2DX_ROOT=/cygdrive/f/Android/cocos2d-2.0-rc2-x-2.0.1
GAME_ROOT=$COCOS2DX_ROOT/molatx
GAME_ANDROID_ROOT=$GAME_ROOT/proj.android
RESOURCE_ROOT=$GAME_ROOT/Resources

buildexternalsfromsource=

usage(){
cat << EOF
usage: $0 [options]

Build C/C++ native code using Android NDK

OPTIONS:
   -s   Build externals from source
   -h   this help
EOF
}

while getopts "s" OPTION; do
    case "$OPTION" in
        s)
            buildexternalsfromsource=1
            ;;
        h)
            usage
            exit 0
            ;;
    esac
done

`# make sure assets is exist`
if [ -d $GAME_ANDROID_ROOT/assets ]; then
    rm -rf $GAME_ANDROID_ROOT/assets
fi

mkdir $GAME_ANDROID_ROOT/assets

`# copy resources`
for file in $RESOURCE_ROOT/*
do
    if [ -d "$file" ]; then
        cp -rf "$file" $GAME_ANDROID_ROOT/assets
    fi

    if [ -f "$file" ]; then
        cp "$file" $GAME_ANDROID_ROOT/assets
    fi
done

`# copy icons (if they exist)`
file=$GAME_ANDROID_ROOT/assets/Icon-72.png
if [ -f "$file" ]; then
    cp $file $GAME_ANDROID_ROOT/res/drawable-hdpi/icon.png
fi
file=$GAME_ANDROID_ROOT/assets/Icon-48.png
if [ -f "$file" ]; then
    cp $file $GAME_ANDROID_ROOT/res/drawable-mdpi/icon.png
fi
file=$GAME_ANDROID_ROOT/assets/Icon-32.png
if [ -f "$file" ]; then
    cp $file $GAME_ANDROID_ROOT/res/drawable-ldpi/icon.png
fi


if [[ $buildexternalsfromsource ]]; then
    echo "Building external dependencies from source"
    $NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
        NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/source
else
    echo "Using prebuilt externals"
    $NDK_ROOT/ndk-build -C $GAME_ANDROID_ROOT \
        NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt
fi

2 个解决方案

#1


1  

You have to install make package using cygwin "setup.exe" wizard. Check what programming language is your script compiling because the compiler of that language will be also dependencies of your script.

您必须使用cygwin“setup.exe”向导安装make package。检查脚本编译的编程语言是什么,因为该语言的编译器也是脚本的依赖项。

Probably you will need to install some libraries too.

可能你也需要安装一些库。

#2


0  

Your Windows system path is different to your Cygwin path. If you install the required packages using cygwin setup they will already be available in your $PATH.

您的Windows系统路径与您的Cygwin路径不同。如果使用cygwin安装程序安装所需的软件包,它们将在$ PATH中可用。

Run cygwin setup an install: make , automake , gcc , gcc-c++

运行cygwin安装程序:make,automake,gcc,gcc-c ++

#1


1  

You have to install make package using cygwin "setup.exe" wizard. Check what programming language is your script compiling because the compiler of that language will be also dependencies of your script.

您必须使用cygwin“setup.exe”向导安装make package。检查脚本编译的编程语言是什么,因为该语言的编译器也是脚本的依赖项。

Probably you will need to install some libraries too.

可能你也需要安装一些库。

#2


0  

Your Windows system path is different to your Cygwin path. If you install the required packages using cygwin setup they will already be available in your $PATH.

您的Windows系统路径与您的Cygwin路径不同。如果使用cygwin安装程序安装所需的软件包,它们将在$ PATH中可用。

Run cygwin setup an install: make , automake , gcc , gcc-c++

运行cygwin安装程序:make,automake,gcc,gcc-c ++