- How to install and use “make” in Windows?
- 10 Answers 10
- Using make from Windows PowerShell
- Any idea for how to run «make» commands in windows #52
- Comments
- rubenmedios commented Jun 4, 2016
- leouieda commented Jun 6, 2016
- jandecaluwe commented Jun 6, 2016 •
- 42sol-eu commented Sep 29, 2016
- GabrielAdeyemi commented Apr 9, 2019
- Patsjemoe commented Aug 3, 2019
- reyesje08 commented Feb 29, 2020
- Rattanpal1 commented Mar 1, 2020
- faizanurrahman commented Aug 10, 2020
- Follow the step:
- kwangalt commented Aug 18, 2020
- Follow the step:
- Komal7209 commented Aug 30, 2020
- newguy commented Oct 15, 2020
- Follow the step:
- make command on windows 10 #2073
- Comments
- AndroidDesigner commented May 7, 2017 •
- sunjoong commented May 7, 2017 •
- AndroidDesigner commented May 7, 2017 •
- sunjoong commented May 7, 2017 •
- AndroidDesigner commented May 7, 2017
- sunjoong commented May 7, 2017 •
- AndroidDesigner commented May 7, 2017 •
- sunjoong commented May 7, 2017
- AndroidDesigner commented May 7, 2017
- Windows 7 — ‘make’ is not recognized as an internal or external command, operable program or batch file
- 12 Answers 12
- What is make ?
- Common Versions of make
- So Which Do I Need?
How to install and use “make” in Windows?
I’m following the instructions of someone whose repository I cloned to my machine. What I want is simple: to be able to use the make command as part of setting up the code environment. But I’m using Windows, and I searched online only to find a make.exe file to download, a make-4.1.tar.gz file to download (I don’t know what to do with it next), and things about downloading MinGW (for GNU; but after installing it I didn’t find any mention of «make»).
I don’t want a GNU compiler or related stuff; I only want to use «make» in Windows. Please tell me what I should do to accomplish that.
Thanks in advance!
10 Answers 10
make is a GNU command so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Anyway, there are several options for getting that:
The most simple choice is using Chocolatey. First you need to install this package manager. Once installed you simlpy need to install make (you may need to run it in an elevated/admin command prompt) :
Other recommended option is installing a Windows Subsystem for Linux (WSL/WSL2), so you’ll have a Linux distribution of your choice embedded in Windows 10 where you’ll be able to install make , gcc and all the tools you need to build C programs.
For older Windows versions (MS Windows 2000 / XP / 2003 / Vista / 2008 / 7 with msvcrt.dll) you can use GnuWin32.
An outdated alternative was MinGw, but the project seems to be abandoned so it’s better to go for one of the previous choices.
Using make from Windows PowerShell
Under Linux, sources of projects commonly come with Makefile ‘s. Makefiles contain directives to build these projects using the command make . I am currently forced to use Windows, and so as to be able to use this OS I configured and enhanced the «PowerShell» (by installing some additional programs, such as vim or svn , a module called PSReadLine , writing a PowerShell profile, etc.).
However I could not find whether it is possible to install make in PowerShell. I am aware that I will also have to install programs that make will call, such as, say, g++ or pdflatex , but that’ll be for later. For now I would like to get make itself working in the first place.
A bit of research revealed two possibilities:
The accepted answer to this very similar question: How to use makefiles on Windows, suggests to use Cygwin. That’s a possibility, Cygwin is great, but since I decided to give PowerShell a chance I would like to know whether this is also possible with PowerShell, not Cygwin. Hence this question is not a duplicate, since that other question was about some possibility to use make in Windows, whereas I am asking for PowerShell in particular.
There exists a make clone for PowerShell clone called poshmake, but the syntax of the Poshmake files is different from usual Makefiles, which is a no-go. I want a true make , as maintaining two versions of Makefiles for all the projects I have lying around is not an option.
So: is it possible to install GNU make, which will understand the syntax of typical Makefiles, such that I can call make from within PowerShell?
Any idea for how to run «make» commands in windows #52
Comments
rubenmedios commented Jun 4, 2016
I try the system, but haven’t luck, the result is this
I’m on Windows 10
The text was updated successfully, but these errors were encountered:
leouieda commented Jun 6, 2016
@rubenmedios you can try downloading the Make executable from http://www.mingw.org/. Though I remember that it’s not very straight forward.
How did you get your bash environment?
jandecaluwe commented Jun 6, 2016 •
@rubenmedios make is an external task automation tool that has basically nothing to do with urubu . Of course, many people on Linux/Unix like to use it because that’s were it comes from.
I have close to zero experience with Windows. However, on one occasion I had to install urubu for a customer and I got it to work, including the make utitlity. So it should be possible to set this up. Otherwise, just use the urubu commands natively, as described in the manual.
42sol-eu commented Sep 29, 2016
@rubenmedios could you specify more details on the problem — if it is still active?
basic info would be:
WHY do you want to use make (and not cmake or qmake)
HOW does your environment look like
do you use a integrated development environment (IDE) for your project ((if not look at PyCharm CE))
on windows you can use mingw32-make.exe — if you installed the compiler and add the path to your environment variable PATH
to check it:
- open the execute dialog (win+R)
- open a command prompt by entering cmd.exe (plus enter)
- write «set PATH» without the apostrophe
OR use rapid environment editor to look at the PATH variable.
Sorry if this is too low level — but from your question I assumed that you did not know it.
Feel free to ask for more advice.
Felix
GabrielAdeyemi commented Apr 9, 2019
If it is only to generate binary files, I use:
Patsjemoe commented Aug 3, 2019
Hi,
make, cmake, mingw32-make. all of them give an error command not found.
any suggestions ?
thanks
regards
ludo
reyesje08 commented Feb 29, 2020
I’m running bash (Version 4.4.12(3)-release (x86_64-cygwin) on Windows 10.
When i ran the ‘make’ command i received the bash: make: command not found
I searched in my mingw program files for the (make) executable. C. \MinGW\bin\make.exe
I then added the make executable directory location as one of my PATH environments
Restart bash and make was able to work.
Rattanpal1 commented Mar 1, 2020
Just add environment variable
C:\Program Files (x86)\GnuWin32\bin
faizanurrahman commented Aug 10, 2020
Follow the step:
Step 1 — Install Mingw, through the MinGW installer.
Step 2 — Open Command Prompt, Try to type mingw-get, if this command is working then follow the next step otherwise go to step one and install it properly.
Step 3 — In command prompt, type mingw-get install mingw32-make.exe, and hit enter. An appropriate make version will be installed in your computer.
Step 4 — Go to C:/MingW/bin folder and find the mingw32-make.exe file and copy it and paste it in the same folder and then rename the copied file to make.exe, That’s it. Now you are good to go. type command make in prompt to see it’s working or not.
kwangalt commented Aug 18, 2020
Follow the step:
Step 1 — Install Mingw, through the MinGW installer.
Step 2 — Open Command Prompt, Try to type mingw-get, if this command is working then follow the next step otherwise go to step one and install it properly.
Step 3 — In command prompt, type mingw-get install mingw32-make.exe, and hit enter. An appropriate make version will be installed in your computer.
Step 4 — Go to C:/MingW/bin folder and find the mingw32-make.exe file and copy it and paste it in the same folder and then rename the copied file to make.exe, That’s it. Now you are good to go. type command make in prompt to see it’s working or not.
-this has worked for me, thanks
Komal7209 commented Aug 30, 2020
It’s still not working for me
newguy commented Oct 15, 2020
Follow the step:
Step 1 — Install Mingw, through the MinGW installer.
Step 2 — Open Command Prompt, Try to type mingw-get, if this command is working then follow the next step otherwise go to step one and install it properly.
Step 3 — In command prompt, type mingw-get install mingw32-make.exe, and hit enter. An appropriate make version will be installed in your computer.
Step 4 — Go to C:/MingW/bin folder and find the mingw32-make.exe file and copy it and paste it in the same folder and then rename the copied file to make.exe, That’s it. Now you are good to go. type command make in prompt to see it’s working or not.
this didnot work for me. I am using make to start a postgres db for my go project.
make command on windows 10 #2073
Comments
AndroidDesigner commented May 7, 2017 •
hi.
sorry for this low-level question.
I need to use «make» command of ubuntu in the windows 10 for a purpose.
I have installed the Bash on windows, but when I type : «sudo apt-get install make» to install it, it gives me this message:
sudo : unable to resolve host
sudo : no tty present and no askpass program specified
Im new to ubuntu and want to execute linux command in the windows 10.
how can I run the make command?
thanks
The text was updated successfully, but these errors were encountered:
sunjoong commented May 7, 2017 •
@AndroidDesigner — I think it’s not clear whether /etc/resolv.conf makes that problem or sudo makes. Check this; command cat /etc/resolv.conf or cat /run/resolvconf/resolv.conf . Next option would set default user to root for not to need using sudo; lxrun /setdefaultuser root in WindowsPowershell after exit all bash consoles. After that, reopen bash console, and then you are root; you don’t need sudo, just apt-get command.
AndroidDesigner commented May 7, 2017 •
thank you for your reply.
this is my bash screen shot:
$ cat /etc/resolv.conf
DO NOT EDIT THIS FILES BY HAND— YOUR CHANGES WILL BE OVERWRITTEN.
nameserver 192.168.1.1
nameserver 8.8.8.8
$ lxrun /setdefaultuser root
lxrun: command not found
🙁
why lxrun didnt find at all?
I should say that I used «DDoSolitary/LxRunOffline» to install BashOnWindows offline.
sunjoong commented May 7, 2017 •
@AndroidDesigner — 192.168.1.1 is a private network address. For example, my name servers are 219.250.36.130 and 210.220.163.82, and those are all on public network. BTW, LxRun.exe is a windows program used in background when installing Bash on Ubuntu on Windows , so it should exist.
AndroidDesigner commented May 7, 2017
I know 192.168.1.1 is my private IP.
how can I fix this problem?how can I use the «make» command by the BashOnWindows finally?
sunjoong commented May 7, 2017 •
@AndroidDesigner —
8.8.8.8 is a public address of google-public-dns-a.google.com. But. strange. why do you use that? In cmd.exe of windows, command this nslookup archive.ubuntu.com . If nameserver replay address like 91.189.88.152 , that might not /etc/resolv.conf problem. And, retry lxrun on WindowsPowershell, not on linux.
AndroidDesigner commented May 7, 2017 •
thank you very much for your step by step help.
I run your command. yes it gives me 91.189.88.152 .
now I want to fix the «make» problem :
- I deleted «hosts» file in the «C:\Users \AppData\Local\lxss\rootfs\etc» and re-open the bash.
- again I refered to this file and saw that this file has changed :
127.0.0.1 localhost
127.0.1.1 GHASEM-PC.localdomain GHASEM-PC /*this line is added */
.
- then I run again : «sudo apt-get install make»
now gives me this message :
«sudo : no tty present and no askpass program specified»
and «sudo : unable to resolve host » has removed.
how do I have to include password in my command?I think askpass is for password.
sunjoong commented May 7, 2017
@AndroidDesigner — apt-get install make , not «sudo apt-get install make». After command lxrun /setdefaultuser root in WindowsPowershell, and reopen bash, you are root user, means you do not need «sudo»; sudo means Switch User (to root) and DO (something).
AndroidDesigner commented May 7, 2017
dear sunjoong
its done!
thank you very much.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Windows 7 — ‘make’ is not recognized as an internal or external command, operable program or batch file
I have Windows 7 and tried to use the ‘make’ command but ‘make’ is not recognized as an internal or external command.
I did Start -> cmd -> run -> make , which outputs:
‘make’ is not recognized as an internal or external command,operable program or batch file.
Then I typed ‘mingw32-make’ instead of ‘make’ ( Start -> cmd -> run -> mingw32-make ) and I get the same output:
‘mingw32-make’ is not recognized as an internal or external command,operable program or batch file.
What shall I do next in order to fix this problem?
12 Answers 12
Your problem is most likely that the shell does not know where to find your make program. If you want to use it from «anywhere», then you must do this, or else you will need to add the full path each time you want to call it, which is quite cumbersome. For instance:
This is to be taken as an example, it used to look like something like this on XP, I can’t say on W7. But gnuwin32 used to provide useful «linux-world» packages for Windows. Check details on your provider for make.
So to avoid entering the path, you can add the path to your PATH environment variable. You will find this easily. To make sure it is registered by the OS, open a console (run cmd.exe ) and entering $PATH should give you a list of default pathes. Check that the location of your make program is there.
In Windows10, I solved this issue by adding «C:\MinGW\bin» to Path then called it using MinGW32-make not make
This is an old question, but none of the answers here provide enough context for a beginner to choose which one to pick.
What is make ?
make is a traditional Unix utility which reads a Makefile to decide what programs to run to reach a particular goal. Typically, that goal is to build a single piece of software; but make is general enough to be used for various other tasks, too, like assembling a PDF from a collection of TeX source files, or retrieving the newest versions of each of a set of web pages.
Besides encapsulating the steps to reach an individual target, make reduces processing time by avoiding to re-execute steps which are already complete. It does this by comparing time stamps between dependencies; if A depends on B but A is newer than B, there is no need to make A . Of course, in order for this to work properly, the Makefile needs to document all such dependencies.
Notice that the indentation needs to consist of a literal tab character. This is a common beginner mistake.
Common Versions of make
The original make was rather pedestrian. Its lineage continues to this day into BSD make , from which nmake is derived. Roughly speaking, this version provides the make functionality defined by POSIX, with a few minor enhancements and variations.
GNU make , by contrast, significantly extends the formalism, to the point where a GNU Makefile is unlikely to work with other versions (or occasionally even older versions of GNU make ). There is a convention to call such files GNUmakefile instead of Makefile , but this convention is widely ignored, especially on platforms like Linux where GNU make is the de facto standard make .
Telltale signs that a Makefile uses GNU make conventions are the use of := instead of = for variable assignments (though this is not exclusively a GNU feature) and a plethora of functions like $(shell . ) , $(foreach . ) , $(patsubst . ) etc.
So Which Do I Need?
Well, it really depends on what you are hoping to accomplish.
If the software you are hoping to build has a vcproj file or similar, you probably want to use that instead, and not try to use make at all.
In the general case, MinGW make is a Windows port of GNU make for Windows, It should generally cope with any Makefile you throw at it.
If you know the software was written to use nmake and you already have it installed, or it is easy for you to obtain, maybe go with that.
You should understand that if the software was not written for, or explicitly ported to, Windows, it is unlikely to compile without significant modifications. In this scenario, getting make to run is the least of your problems, and you will need a good understanding of the differences between the original platform and Windows to have a chance of pulling it off yourself.
In some more detail, if the Makefile contains Unix commands like grep or curl or yacc then your system needs to have those commands installed, too. But quite apart from that, C or C++ (or more generally, source code in any language) which was written for a different platform might simply not work — at all, or as expected (which is often worse) — on Windows.