Using make command in windows

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.

Читайте также:  Registry life для windows 10

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.

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.

How to run a makefile in Windows?

I have some demos that I downloaded and they come with a Makefile.win and a Makefile.sgi. How can I run these in Windows to compile the demos?

17 Answers 17

If you have Visual Studio, run the Visual Studio Command prompt from the Start menu, change to the directory containing Makefile.win and type this:

You can also use the normal command prompt and run vsvars32.bat (c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools for VS2008). This will set up the environment to run nmake and find the compiler tools.

Читайте также:  Ulimits linux что это

You can install GNU make with chocolatey, a well-maintained package manager, which will add make to the global path and runs on all CLIs (powershell, git bash, cmd, etc…) saving you a ton of time in both maintenance and initial setup to get make running.

Install the chocolatey package manager for Windows
compatible to Windows 7+ / Windows Server 2003+

Run choco install make

I am not affiliated with choco, but I highly recommend it, so far it has never let me down and I do have a talent for breaking software unintentionally.

Check out cygwin, a Unix alike environment for Windows

Check out GnuWin’s make (for windows), which provides a native port for Windows (without requiring a full runtime environment like Cygwin)

If you have winget, you can install via the CLI like this:

Also, be sure to add the install path to your system PATH :

Here is my quick and temporary way to run a Makefile

  • download make from SourceForge: gnuwin32
  • install it
  • go to the install folder
  • copy the all files in the bin to the folder that contains Makefile
  • open the cmd(you can do it with right click with shift) in the folder that contains Makefile and run

Plus, you can add arguments after the command, such as

If you install Cygwin. Make sure to select make in the installer. You can then run the following command provided you have a Makefile.

With Visual Studio 2017 I had to add this folder to my Windows 10 path env variable:

There’s also HostX86

If it is a «NMake Makefile», that is to say the syntax and command is compatible with NMake, it will work natively on Windows. Usually Makefile.win (the .win suffix) indicates it’s a makefile compatible with Windows NMake. So you could try nmake -f Makefile.win .

Often standard Linux Makefiles are provided and NMake looks promising. However, the following link takes a simple Linux Makefile and explains some fundamental issues that one may encounter. It also suggests a few alternatives to handling Linux Makefiles on Windows.

I use MinGW tool set which provides mingw32-make build tool, if you have it in your PATH system variables, in Windows Command Prompt just go into the directory containing the files and type this command:

Firstly, add path of visual studio common tools ( c:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools ) into the system path. To learn how to add a path into system path, please check this website: http://www.computerhope.com/issues/ch000549.htm. You just need to this once.

After that, whenever you need, open a command line and execute vsvars32.bat to add all required visual studio tools’ paths into the system path.

Then, you can call nmake -f makefile.mak

PS: Path of visual studio common tools might be different in your system. Please change it accordingly.

I tried with cygwin & gnuwin, and didn’t worked for me, I guess because the makefile used mainly specific linux code.

What it worked was use Ubuntu Bash for Windows 10. This is a Marvel if you come from MAC as it is my case:

  1. To install the Ubuntu Bash: https://itsfoss.com/install-bash-on-windows/
  2. Once in the console, to install make simply type «make» and it gives the instructions to download it.

Extras:

  1. Useful enable copy / paste on bash: Copy Paste in Bash on Ubuntu on Windows
  2. In my case the make called Maven, so I have to install it as well: https://askubuntu.com/questions/722993/unable-to-locate-package-maven
  3. To access windows filesystem C: drive, for example: «cd /mnt/c/»

I tried all of the above. What helps me:

  1. Download the mingw-get.
  2. Setup it.
  3. Add something like this C:\MinGW\bin to environment variables.
  4. Launch (!important) git bash. Power shell, developer vs cmd, system cmd etc didn’t help.
  5. Type mingw-get into the command line.
  6. After type mingw-get install mingw32-make .

Done! Now You might be able to use make-commands from any folder that contains Makefile.

  1. Download from https://sourceforge.net/projects/gnuwin32/
  2. Set the variable path in advance setting for recognize in command prompt (C:\Program Files (x86)\GnuWin32\bin)

Install msys2 with make dependency add both to PATH variable. (The second option is GNU ToolChain for Windows. MinGW version has already mingw32-make included.)

Install Git Bash. Run mingw32-make from Git Bash.

Читайте также:  Ноутбук для установки linux

I am assuming you added mingw32/bin is added to environment variables else please add it and I am assuming it as gcc compiler and you have mingw installer.

First step: download mingw32-make.exe from mingw installer, or please check mingw/bin folder first whether mingw32-make.exe exists or not, else than install it, rename it to make.exe .

After renaming it to make.exe , just go and run this command in the directory where makefile is located. Instead of renaming it you can directly run it as mingw32-make .

After all, a command is just exe file or a software, we use its name to execute the software, we call it as command.

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 :

  1. I deleted «hosts» file in the «C:\Users \AppData\Local\lxss\rootfs\etc» and re-open the bash.
  2. 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 */
.

  1. 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.

Оцените статью