-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Fix windows build issue: Build gets stuck if sh.exe is in PATH #859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
On Windows the $(shell ...) function uses sh.exe (BASH) if it is in PATH, otherwise it uses cmd.exe. If SH is used then the "/C" option is interred as the C:\ drive and not the CMD option which tells the CMD to run the command and exit. Since "/C" is interpreted the wrong way CMD doesn't exit and the MAKE process gets stuck (doesn't return an error or continue). But if CMD is used then "/C" is interred correctly and the build continues. sh.exe can get added to PATH when installing git, but it depends on the selected options. The solution is to just use POWERSHELL to create the directory.
|
Maybe a better option is to set `SHELL=cmd" somewhere in the Makefile, to disable make's search for a suitable shell. |
|
I considered this option, but this was the only place in the Makefiles that explicitly called But you are right. Adding If it is preferred I can update this PR. Let me know. |
|
Sorry for the spam. I tried to rename the branch, but I guess I don't know how to do that :). |
|
Reading https://www.gnu.org/software/make/manual/html_node/Choosing-the-Shell.html it is a mess to set the shell. Perhaps On the other hand, creating directories when parsing a Makefile sounds really bad, so I'd prefer if it could be done via recipes instead. Is that what you mean with powershell solution? |
|
I did some testing, using both make installed with chocolatey and Scoop. MAKESHELLI tested
I think since Window 7/10/11 don't fall in the category MS-DOS, the EXPORT SHELLI tried
But MAKEOVERRIDEIn the documentation it says that if we set a variable in the command line it gets passed down to sub-make calls through the |
I can add so that
Here is what I meant by the "powershell solution":
|
|
Are there any other problems or reasons why this pull request can't be merged? The changes to makefiles only affect Windows users and I did a lot of testing to make sure everything works. To summarize the problem only occurs if the shell I installed
|
On Windows the
$(shell ...)function usessh.exe(bash) if it is in PATH, otherwise it usescmd.exe.If
shis used then the/Coption is interpreted as theC:\drive and not thecmdoption which tells thecmdto run the command and exit. Since/Cis interpreted the wrong waycmddoesn't exit and themakeprocess gets stuck (doesn't return an error or continue).But if
cmdis used then/Cis interred correctly and the build continues.shcan get added to PATH when installing git, but it depends on the selected options. It is also added if git is installed via the Scoop package manager or MSYS2 is installed.The solution is to just use
powershellto create the directory.I tested both options when
shis in PATH and when it is not and it worked both times.