Thursday, January 17, 2013

Error "Program bash not found in PATH" when building cocos2dx with eclipse cdt build command

Setting up Cocos2dx Android project is tricky. Though this article is very good as a guidance, I still got some problems. One is
When setting the command build in eclipse CDT with the command
bash ${ProjDirPath}/build_native.sh NDK_DEBUG=1 V=1
it complained
"Program "[path]/bash" not found in PATH".
However, we need to use build_native.sh to build the project because Cocos2dx team has done it well and it also configured paths for cocos2dx project(though you can do your own as long as you want to challenge yourself on this). So we need to find a way to run the build_native.sh.

After blood sweat and tears, I found out that this was because I used the NDK plugin to convert the project into C++ project and NDK plugin set builder Android Builder as below

Then the eclipse will be using Android NDK settings to build to project and could not recognise the bash command.

If you use "add native support" to convert the project to C++ project by Android tools and met the same problem. Switch the current builder to GNU Maker Builder, problem fixed!

Make sure you go back c/c++ Build option to reset the build command line to 
bash ${ProjDirPath}/build_native.sh NDK_DEBUG=1 V=1
as switching current builder will reset build command to default one!

3 comments:

  1. Dear Kejun,

    I am new to cocos2d-x. I configure cocos2d-x in Windows 8 / Eclipse.
    First of all this post has been greatly helpful. Thank you.
    Just like you, I also had this problem "Program bash not found in PATH", but now the problem is fixed!
    But now I'm with another problem that appeared after the problem of "bash" is resolved. I created a project that is running, but when I run project that gives an error:
    " [2013-04-30 09:41:20 - Unable to launch cygpath. Is Cygwin on the path?] java.io.IOException: Cannot run program "cygpath": CreateProcess error=2, The system cannot find the file specified "
    I've googled plenty on the internet for the solution of the problem, but for now I still can not solve it. I have already add a variable in "Build Variables" with name of "PATH" the type of "Directory" and which value is "C:\cygwin\bin".
    I'm following instructions as this site/course: http://www.lynda.com/Android-tutorials/Building-Monetizing-Game-Apps-Android/107169-2/transcript, but this course does not cover all the topics or problems that may appear.
    Do you have any ideas about what I'm missing or doing wrong?
    Excuse my english, I speak portuguese.
    Appreciate any help, thanks.

    ReplyDelete
  2. Dear Kejun i am currently facing the same problem as you mentioned above..If you solved it uptil now.Please guide me.Thanks in advance :)

    ReplyDelete