kubernetes building on macos fails for missing bin directories

5/28/2020

New to K8s source code. Trying to setup to build on macos. I am pasting my GOPATH, GOROOT, GOPATH_KSS

cat ~/.bash_profile 
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home
export GOPATH=/Users/mramakrishnan/Documents/workspaces/go
export GOROOT=/usr/local/go
export PATH=$PATH:$GOROOT/bin
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
export GOPATH_KSS=$GOPATH/src/k8s.io/kubernetes
export PATH=$PATH:$GOPATH_KSS/third_party/etcd
export PATH=$PATH:$GOPATH_KSS/kubernetes/_output/local/go/bin 

When I build with commands like build/run.sh make kubectl KUBE_BUILD_PLATFORMS=darwin/amd64 or run ./hack/local-up-cluster.sh 
I get errrors related to this. I searched and found and tried muliple articles/videos. Nothing is helping. 
_output/local/go/bin

**Errors** 

./hack/local-up-cluster.sh 
WARNING : This script MAY be run as root for docker socket / iptables functionality; if failures occur, retry as root.
+++ [0527 18:16:10] Building go targets for darwin/amd64:
    ./vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen
rm: /Users/mramakrishnan/Documents/workspaces/go/src/k8s.io/kubernetes/_output/bin: is a directory

This is likely because I created directories called bin with relevant directories: ls _output/bin/ conversion-gen deepcopy-gen defaulter-gen openapi-gen

If I rename the bin and the manually created dirs, then it complains about not finding those as you see below:

kubernetes mramakrishnan$ ./hack/local-up-cluster.sh 
WARNING : This script MAY be run as root for docker socket / iptables functionality; if failures occur, retry as root.
+++ [0528 14:20:31] Building go targets for darwin/amd64:
    ./vendor/k8s.io/code-generator/cmd/prerelease-lifecycle-gen
touch: **_output/bin/prerelease-lifecycle-gen: No such file or directory**

I am on the following version of go : go version go version go1.13.4 darwin/amd64

Any tips on how to succesfully build would help.

-- Manoj Ramakrishnan
kubernetes

0 Answers