Home » Android » android – How to set GNUMAKE variable for ndk-build to work

android – How to set GNUMAKE variable for ndk-build to work

Posted by: admin June 15, 2020 Leave a comment


I am trying to make ndk-build to work within Cygwin on windows. As per the NDK documentation (specifically INSTALL.htm), “The NDK requires GNU Make 3.81 or later being available on your development.”

I have Gnu Make installed on my computer.

So far, so good.

Within Cygwin bash, I cd over to the android NDK root directory. Now when I type in the following command (without parameters right now, just to see if the command works):

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

So I try to set the GNUMAKE variable, but no luck:

$export GNUMAKE=’/cygdrive/c\Program Files\GnuWin32\bin’
ERROR: Your GNUMAKE variable is defined to an invalid name: /cygdrive/c\Program Files\GnuWin32\bin
Please fix it to point to a valid make executable (e.g. usr/bin/make)

I even tried setting it to usr/bin/make as it suggests, but same invalid name error.

Anyone, knows how to resolve this?

I’m using Windows 7, NDK r5, Cygwin 1.7.1

How to&Answers:

I had an issue with GNUMake when putting the ndk in a folder with a space in it (I originally put it in the program files directory). I moved everything to C:/android/android-ndk and C:/android/android-sdk and updated my path settings to include these directories.


Its not problem with the make but installing cygwin
in ndk-demo script the make path is found using which command mostly which command
installation is missing in cygwin.

Relaunch your cygwin installation select utils (install )

$ which make
should give you the make command path on cygwin prompt.



This is a generic error. It means there was a problem somehow with the make command, but the error message itself is hidden. To help diagnose the problem, open your ndk_build script in the ndk directory, and change these lines:

ABS_GNUMAKE=`which $GNUMAKE 2> /dev/null`
GNUMAKE=`which make 2> /dev/null`

to these:

GNUMAKE=`which make`

And then you will get a more detailed error message. Note that it might not even be a problem with the ‘make’ command, it might be a problem with the ‘which’ command. Make sure you have cygwin installed.


delete Environmental variable GNUMAKE
close the cygwin terminal
open again cygwin terminal… go the path where u want to build.. and now build it…
I am sure hopefully you will build successfully..as i do..


The answer with moving NDK to a directory without spaces is definitely right. After that you will probably able to run ndk-build from the Cygwin shell.
However running ndk-build from Windows commmand line (like “bash ndk-build”) will probably cause the same queer error with “incorrect GNU make”.
It is reproducible with NDK 6b as well.
And I hope it is fixed in the newest version of NDK…


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

While trying to install Cygwin i missed out to install MAKE PACKAGE

Just need to search make in the Search box and it will shows the Branches that includes devel branch and from devel branch i selected make package.

That’s all issue fixed.


i worked hard on error in gygwin terminal “gnumake variable is define to invalid name” and after that i get to the point that we simply remove this error by deleting the GNUMAKE path in environment variable both in system and user variable if u created it hope its helps….

mycomputer > system properties > advanced system setting > environment variable


The problem here is the name of the GNUMAKE variable.The name given was

/cygdrive/c\Program Files\GnuWin32\bin change it into /cygdrive/c/Program Files/GnuWin32/bin/make

only use forword Slash .Sometime the space in the folder structure does not taken

Happy coding.