Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot use ndk-build on Cygwin

I have to use NDK for a clien't project. I am using Windows 7.

I followed the installation instructions. I have installed Cygwin 1.7.1.

In Cygwin bash, I go into the android NDK root directory.

When I see the contents of the directory, usin $dir command, I can see all the contents including ndk-build, but when I try to use ndk-build, this is the result I get:

$ndk-build bash: ndk-build: command not found.

Not sure what I am doing wrong.

like image 264
OceanBlue Avatar asked Dec 04 '22 09:12

OceanBlue


1 Answers

Cygwin emulates a GNU/Linux environment on your Windows computer. This means you're working with a "Shell" which is not exactly the same as the Windows command-line.

If you type asdf.exe in your Windows command-line, it tries to find asdf.exe in the current directory. If it can find it, the file is executed. If it can't find it, it'll go through every directory of your %PATH% and try again.

However, if you type asdf in your bash (there are multiple kind of shells, the Bourne Again SHell is one of them), it will not look after it in the current directory. Instead it'll try to find it in one of your PATH directories. Can't give you any sources here, but AFAIK it's for security reasons. If you want to run a file which is not in your PATH, you must prepend it with its absolute of relative path. You can use ./, it points to the current directory.

That's why you need to type ./ndk-build, because it's in the current directory and not your path. Something like /path/to/ndk/ndk-build will also work, but you have to type a bit more :).

(In fact it's even more complicated, if you want to execute a file, you need execute permissions for it. Google will help you if you have any problems with that.)

like image 128
svens Avatar answered Dec 26 '22 16:12

svens