简体   繁体   English

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

[英]how to run .sh file on windows using cygwin?

I am beginner of cygwin terminal. 我是cygwin Terminal的初学者。 I am trying to run *.sh file on windows 8 using command ./file_name.sh , but it gives error given below.... 我正在尝试使用命令./file_name.sh在Windows 8上运行*.sh文件,但是它给出以下错误。

Using prebuilt externals

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

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. 我已在F驱动器中安装了cygwin ,我用google搜索了此错误,并在computer properties > advance system properties > variable environment > path >edit设置了变量路径,变量路径为;F:\\cygwin\\bin但不起作用。 How can i solve this problem?? 我怎么解决这个问题??

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

You have to install make package using cygwin "setup.exe" wizard. 您必须使用cygwin“ setup.exe”向导安装make软件包。 Check what programming language is your script compiling because the compiler of that language will be also dependencies of your script. 检查您的脚本正在编译哪种编程语言,因为该语言的编译器还将是您脚本的依赖项。

Probably you will need to install some libraries too. 可能您也需要安装一些库。

Your Windows system path is different to your Cygwin path. Windows系统路径与Cygwin路径不同。 If you install the required packages using cygwin setup they will already be available in your $PATH. 如果您使用cygwin安装程序安装所需的软件包,则它们已在$ PATH中可用。

Run cygwin setup an install: make , automake , gcc , gcc-c++ 运行cygwin setup进行安装:make,automake,gcc,gcc-c ++

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM