kops icon indicating copy to clipboard operation
kops copied to clipboard

Cross compiling / building

Open krisnova opened this issue 10 years ago • 16 comments

I am very reluctant to bring this up, but wondering if we have any plans to support our PC friends?

IE: Cross compiling for Windows..

... Or any other platforms?

screen shot 2016-10-25 at 12 58 51 am

krisnova avatar Oct 25 '16 07:10 krisnova

RUN ... no good point. We need to figure it out

chrislovecnm avatar Oct 25 '16 17:10 chrislovecnm

I've started trying to get this to work on my Windows environment which as MsysGit installed.

Issues encountered so far:

  1. We assume Unix style env vars separated by :. In Windows they are separated by ;.
  2. No sha1sum executable exists. I've created #1924 since we shouldn't really require sha1sum to always exist, only if you are running a command that needs it.
  3. Once the above two issues were dealt with I ran into the following:
$ make
go build  -ldflags "" -o c:/Users/yissachar/go//bin/go-bindata k8s.io/kops/vendor/github.com/jteeuwen/go-bindata/go-bindata
cd c:/Users/yissachar/go//src/k8s.io/kops; c:/Users/yissachar/go//bin/go-bindata -o upup/models/bindata.go -pkg models -ignore="\\.DS_Store" -ignore="bindata\\.go" -ignore="vfs\\.go" -prefix upup/models/ upup/models/...
cd c:/Users/yissachar/go//src/k8s.io/kops; c:/Users/yissachar/go//bin/go-bindata -o federation/model/bindata.go -pkg model -ignore="\\.DS_Store" -ignore="bindata\\.go" -prefix federation/model/ federation/model/...
go install  -ldflags "-X k8s.io/kops.Version=1.5.1 -X k8s.io/kops.GitVersion=069a917 " k8s.io/kops/cmd/kops/...
vendor\github.com\docker\docker\pkg\term\windows\ansi_reader.go:14:2: cannot find package "github.com/Azure/go-ansiterm" in any of:
        c:\Users\yissachar\go\src\k8s.io\kops\vendor\github.com\Azure\go-ansiterm (vendor tree)
        c:\Go\src\github.com\Azure\go-ansiterm (from $GOROOT)
        c:\Users\yissachar\go\src\github.com\Azure\go-ansiterm (from $GOPATH)
vendor\github.com\docker\docker\pkg\term\term_windows.go:11:2: cannot find package "github.com/Azure/go-ansiterm/winterm" in any of:
        c:\Users\yissachar\go\src\k8s.io\kops\vendor\github.com\Azure\go-ansiterm\winterm (vendor tree)
        c:\Go\src\github.com\Azure\go-ansiterm\winterm (from $GOROOT)
        c:\Users\yissachar\go\src\github.com\Azure\go-ansiterm\winterm (from $GOPATH)
vendor\github.com\spf13\cobra\command_win.go:9:2: cannot find package "github.com/inconshreveable/mousetrap" in any of:
        c:\Users\yissachar\go\src\k8s.io\kops\vendor\github.com\inconshreveable\mousetrap (vendor tree)
        c:\Go\src\github.com\inconshreveable\mousetrap (from $GOROOT)
        c:\Users\yissachar\go\src\github.com\inconshreveable\mousetrap (from $GOPATH)
c:\Program Files (x86)\Grep\usr\local\wbin\make.exe: *** [kops] Error 1

Any ideas on how to procede?

yissachar avatar Feb 16 '17 06:02 yissachar

For the separator, I don't know make well enough. We could maybe override GOPATH as well, as we don't really need it, but I worry that would cause more edge-cases. Another option is to build for Windows, but not build on Windows. This is how we produce the MacOS binary, for example.

To add the 3 missing dependencies: https://github.com/kubernetes/kops/blob/master/docs/development/dependencies.md

Although we can probably start thinking about looking at the official go dep tool now.

justinsb avatar Feb 17 '17 04:02 justinsb

Ah, I guess these dependencies are platform specific? I think that's what was confusing me. I was wondering why there were no issues with the dependencies on other platforms.

In any case, there were other issues with more missing commands, so for now I've taken the path of least resistance and am using the Linux Subsystem for Windows instead.

yissachar avatar Feb 17 '17 06:02 yissachar

lucky you @yissachar . im on windows 7!!

get issue when checking out repo:

 git checkout release
fatal: cannot create directory at 'vendor/github.com/docker/distribution/contrib/docker-integration/generated_certs.d/localregistry:5440': Invalid argument


shavo007 avatar Jun 26 '17 01:06 shavo007

@shavo007 Getting the same issue, did you make any progress?

msnelling avatar Aug 02 '17 13:08 msnelling

Give up on windows! I run in Ubuntu VM at work or my Mac at home.

shavo007 avatar Aug 03 '17 12:08 shavo007

The issue I'm seeing on Windows (Win10+WSL) is with the docker distribution:

fatal: cannot create directory at 'vendor/github.com/docker/distribution/contrib/docker-integration/generated_certs.d/localregistry:5440': Invalid argument

It looks like they fixed this here: https://github.com/docker/distribution/pull/1716 by generating the certs for the integration tests. Is this something we can update to better support Windows users?

justinliew avatar Sep 01 '17 05:09 justinliew

@justinliew more context please

chrislovecnm avatar Sep 01 '17 17:09 chrislovecnm

If I run git checkout release (or go get -d k8s.io/kop) I eventually get the message above. Specifically I think it doesn't like the : in the path.

The docker project fixed this (see PR link in my previous message) by generating these files rather than requiring they be checked out.

This is Windows 10, with WSL (Windows Subsystem for Linux).

justinliew avatar Sep 01 '17 18:09 justinliew

I have kops.exe compiling on osx for windows. If someone wants to take a test drive :) https://github.com/kubernetes/kops/pull/3770

chrislovecnm avatar Nov 05 '17 04:11 chrislovecnm

I'd be happy to take it for a test drive @chrislovecnm - I couldn't find the binary attached to the last release, should I look somewhere else?

duizendnegen avatar Jan 15 '18 17:01 duizendnegen

@duizendnegen you have to build the binary yourself off of master

chrislovecnm avatar Feb 13 '18 16:02 chrislovecnm

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

fejta-bot avatar May 14 '18 16:05 fejta-bot

Stale issues rot after 30d of inactivity. Mark the issue as fresh with /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle rotten /remove-lifecycle stale

fejta-bot avatar Jun 13 '18 17:06 fejta-bot

Rotten issues close after 30d of inactivity. Reopen the issue with /reopen. Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /close

fejta-bot avatar Jul 13 '18 18:07 fejta-bot