kubernetes: Unable to build kubernetes running 'make'

After merging https://github.com/kubernetes/kubernetes/pull/25978, I am unable to build kubernetes:

./hack/build-go.sh
NOTE: ./hack/build-go.sh has been replaced by 'make' or 'make all'

The equivalent of this invocation is: 
    make 


make: *** No rule to make target `/*.go', needed by `_output/bin/deepcopy-gen'.  Stop.

Before eecbfb1a2808b233a4c7032ce26e260276bffde5:

./hack/build-go.sh
Go version: go version go1.6.2 linux/amd64
+++ [0713 07:36:27] Building the toolchain targets:
    k8s.io/kubernetes/hack/cmd/teststale
+++ [0713 07:36:27] Building go targets for linux/amd64:
    cmd/kube-dns
...

Am I something missing?

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 31 (29 by maintainers)

Commits related to this issue

Most upvoted comments

@thockin

c) leave everything as it is but throw meaningful error when incorrect path is detected.

So I got it working.

clone / symlink k8s sources (top dir) as some_path/src/k8s.io/kubernetes and run make from that dir. Set GOPATH to it to. Works perfectly then.

cc @dims, @ingvagabund

// I’m starting to think that I used this approach even before.

What’s happening is that there is work that is done outside of any rule to evaluate and generate dependencies. when you run make clean all the work is done, then clean removes it, then all tries to use it, but now it is gone.

I’ll think about how to fix this. In the mean time, the solution is simply to run as 2 different rules.

On Thu, Jul 14, 2016 at 7:12 AM, Brian Grant notifications@github.com wrote:

cc @liyouwei https://github.com/liyouwei

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kubernetes/kubernetes/issues/28890#issuecomment-232676903, or mute the thread https://github.com/notifications/unsubscribe/AFVgVKU6vS45Njw3v2LybTxVzsLldppsks5qVkPMgaJpZM4JLVCV .

Ahh, here’s what is happening. It’s actually a confluence of recent changes (all mine) that I did not detect were piling up requirements.

The change to use vendor/ demands that any go tools operate from within the GOPATH, or else they just refuse to find vendored packages. All the hack/* scripts were fixed to chdir into GOPATH. This was the straw that broke my back, so I finally set up a proper GOPATH. Since I was now developing against a GOPATH, I did not experience the problem described here, and when I moved the code-gen tools into Makefile, I did not detect that the GOPATH rule was no longer be patched up automatically.

Sorry about that.

Here are our choices:

a) demand that you always check out kubernetes into a GOPATH (easy for me, burden on you all, probably “correct” anyway) b) write yet another script that mucks with GOPATH and then calls the codegen tools (easy for you all, hacky)

I can whip up a PR for (b), but I’d like feedback on the ideas.

On Wed, Jul 13, 2016 at 8:26 AM, Tim Hockin thockin@google.com wrote:

well, it is Go code, which really does want to be checked out into a GOPATH. Let me see what I can do.

On Wed, Jul 13, 2016 at 7:56 AM, Jan Chaloupka notifications@github.com wrote:

Anyone new getting familiar with kubernetes will clone the repository (to a random directory). Then see Makefile and just runs make (or runs ./hack/build-go.sh as so many people have done so far). Nobody will read the docs unless it is necessary. So need for putting kubernetes under src/ k8s.io directory makes it a little complicated for newbies (and everyone use to it).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/kubernetes/kubernetes/issues/28890#issuecomment-232381267, or mute the thread https://github.com/notifications/unsubscribe/AFVgVGUVMbCNT_ZhuKOUtYeiJEDYSIRbks5qVPylgaJpZM4JLVCV .

You have to had to do the same trick when running e2e-node tests before eecbfb1a2808b233a4c7032ce26e260276bffde5.

@thockin is the assumption of placing the kubernetes under */src/k8s.io directory documented? If not, let’s write one down as a fix for this issue.