Skip to content
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

Cannot build on Windows using GNUMake #4978

Closed
blueelvis opened this issue Aug 4, 2019 · 17 comments
Closed

Cannot build on Windows using GNUMake #4978

blueelvis opened this issue Aug 4, 2019 · 17 comments
Assignees
Labels
area/build-release kind/bug Categorizes issue or PR as related to a bug. os/windows priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@blueelvis
Copy link
Contributor

The exact command to reproduce the issue: make windows

** Version of Make**:

PS D:\dev\minikube> make --version                                                                                                                            GNU Make 4.2.1
Built for Windows32
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

The full output of the command that failed:


PS D:\dev\minikube> make windows The syntax of the command is incorrect.
process_begin: CreateProcess(NULL, pwd, ...) failed.
make: Makefile:59: pipe: Bad file descriptor
'command' is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, uname -s, ...) failed.
make: Makefile:60: pipe: Bad file descriptor
Access denied - CMD
Access denied - PKG
File not found - -TYPE
File not found - F
File not found - -NAME
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
make: Nothing to be done for 'windows'.

The operating system version: Windows 10 Enterprise

PS D:\dev\minikube> $PSVersionTable                                                                                                                           
Name                           Value
----                           -----
PSVersion                      5.1.18362.145
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.145
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
@afbjorklund
Copy link
Collaborator

afbjorklund commented Aug 4, 2019

Please use Docker, when building on Windows. Only Linux is supported as a build environment.

BUILD_IN_DOCKER=y make

@afbjorklund
Copy link
Collaborator

afbjorklund commented Aug 4, 2019

Theoretically it should be possible to build on Mac, or by using MSYS2/WSL when on Windows.

But it is not officially supported.

@afbjorklund
Copy link
Collaborator

afbjorklund commented Aug 4, 2019

Hmm, this might actually be a problem even before docker is started. Just guessing, haven't tried.
Since we are running shell commands from make, that probably don't work very well on Windows.

CMD_SOURCE_DIRS = cmd pkg

out/minikube-%: pkg/minikube/assets/assets.go pkg/minikube/translate/translations.go  $(shell find $(CMD_SOURCE_DIRS) -type f -name "*.go")
ifeq ($(MINIKUBE_BUILD_IN_DOCKER),y)
	$(call DOCKER,$(BUILD_IMAGE),/usr/bin/make $@)
else

Access denied - CMD
Access denied - PKG
File not found - -TYPE
File not found - F
File not found - -NAME
FIND: Parameter format not correct

So we might have to wrap that find hack in some variables, and only call if not building in docker.
Or we have to require a reasonable shell (also on Windows), even for just run the make command ?

Because this happens all over the place:

PYTHON := $(shell command -v python || echo "docker run --rm -it -v $(shell pwd):/minikube -w /minikube python python")

'command' is not recognized as an internal or external command, operable program or batch file.

BUILD_OS := $(shell uname -s)

process_begin: CreateProcess(NULL, uname -s, ...) failed.

Fortunately, bash is rather easy to find...

@afbjorklund
Copy link
Collaborator

ping @tstromberg

@afbjorklund
Copy link
Collaborator

I think we should just document that building minikube requires GNU bash and GNU make ?

It should not be a problem on the other platforms, so it mostly affects any Windows developers.

https://minikube.sigs.k8s.io/docs/contributing/building/

Prerequisites

  • A recent Go distribution (>=1.12)
  • If you are on Windows, you’ll need Docker to be installed.
  • 4GB of RAM

Wonder if building the out/minikube.exe itself works without Docker ? Can't see why it shouldn't.

Basically all it does is call go-bindata, gofmt and then go build. And some shell commands...

@tstromberg tstromberg added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Aug 8, 2019
@tstromberg tstromberg changed the title Cannot Build Minikube on Windows using GNUMake Cannot build on Windows using GNUMake Aug 8, 2019
@tstromberg
Copy link
Contributor

It isn't ideal, but in the short term, we may have to require running builds under bash for Windows with a handful of other prereqs. These should be documented.

FWIW, I would rather not run builds through Docker if I can avoid it.

@blueelvis
Copy link
Contributor Author

blueelvis commented Aug 13, 2019

Assigning this to myself. Let me see what can be if this can run directly from Bash for Windows.

/assign

@blueelvis blueelvis self-assigned this Aug 13, 2019
@medyagh
Copy link
Member

medyagh commented Aug 22, 2019

@blueelvis we could also update the documentation for contributing
to show how to build on windows
https://minikube.sigs.k8s.io/docs/contributing/building/

@blueelvis
Copy link
Contributor Author

@medyagh - Right now, I am using WSL on Windows 10 to do the compilation. I run tests and everything inside the WSL environment only.

Should we add that as well to the documentation?

@tstromberg
Copy link
Contributor

make should work now. Is there something we need to do with the docs?

@blueelvis
Copy link
Contributor Author

@tstromberg - I just tried on my machine and this is still an issue. I am not able to make because of the same issue. Reopening this.

@blueelvis blueelvis reopened this Sep 21, 2019
@tstromberg tstromberg added the kind/bug Categorizes issue or PR as related to a bug. label Sep 21, 2019
@tstromberg
Copy link
Contributor

@blueelvis - Do you mind sharing the result? I believe @sharifelgamal may have been using git-bash. Do you mind sharing the error message you are hitting?

@blueelvis
Copy link
Contributor Author

@tstromberg - I think it is the same as above -

PS D:\dev\minikube> make
The syntax of the command is incorrect.
process_begin: CreateProcess(NULL, pwd, ...) failed.
make: Makefile:75: pipe: Bad file descriptor
'command' is not recognized as an internal or external command,
operable program or batch file.
process_begin: CreateProcess(NULL, uname -s, ...) failed.
make: Makefile:76: pipe: Bad file descriptor
Access denied - CMD
Access denied - PKG
File not found - -TYPE
File not found - F
File not found - -NAME
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
FIND: Parameter format not correct
cp out/minikube-windows-amd64.exe out/minikube.exe
process_begin: CreateProcess(NULL, cp out/minikube-windows-amd64.exe out/minikube.exe, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [Makefile:134: out/minikube.exe] Error 2

@afbjorklund
Copy link
Collaborator

This doesn't look like a bash shell.

What version of make is this ? Maybe it has some weird setting for the SHELL variable ?

Might have to add some basic sanity checking to the Makefile, perhaps even set the shell.

SHELL = /bin/sh

@sharifelgamal
Copy link
Collaborator

yeah make doesn't currently work in powershell, only in something that can run bash commands, and is documented as such.

@medyagh
Copy link
Member

medyagh commented Oct 9, 2019

@sharifelgamal @blueelvis is there any update on this issue,
did we figure out what is our recommended way for building on windows ? so we could update the docs?

@sharifelgamal
Copy link
Collaborator

sharifelgamal commented Oct 9, 2019

Yeah this is documented as needing a bash shell, we can close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build-release kind/bug Categorizes issue or PR as related to a bug. os/windows priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

No branches or pull requests

5 participants