little-angry-clouds / homebrew-my-brews

1 stars 1 forks source link

Problem installing kbenv #27

Closed theweswing closed 2 years ago

theweswing commented 2 years ago

Details: Apple Silicon chip, OSX 12.2

Trying to install Kbenv,

$ brew tap little-angry-clouds/homebrew-my-brews works

$ brew install kbenv

Throws me a handful of errors and does not work.

➜ ~ brew install kbenv ==> Downloading https://github.com/little-angry-clouds/kubernetes-binaries-managers/archive/0.3.1.tar.gz Already downloaded: /Users/wschierenbeck/Library/Caches/Homebrew/downloads/3e2e8e7e420cfd8a2d3b0e02487edf29faaced49a62b6469e766940361e42d3c--kubernetes-binaries-managers-0.3.1.tar.gz ==> Installing kbenv from little-angry-clouds/my-brews ==> go build -a -o kbenv.bin cmd/kbenv/main.go Last 15 lines from /Users/wschierenbeck/Library/Logs/Homebrew/kbenv/01.go: kbenv.bin cmd/kbenv/main.go

golang.org/x/sys/unix

/Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.1_13.go:27:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.1_13.go:40:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:28:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:43:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:59:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:75:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:90:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:105:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:121:3: //go:linkname must refer to declared function or variable /Users/me/Library/Caches/Homebrew/go_mod_cache/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_arm64.go:121:3: too many errors

I'm a bit new to all of this, so I'm not sure how to make heads or tails of this. Might it have something to do with this section?

Installation There are two components in kbenv. One is the kbenv binary, the other one is a kubectl wrapper. It works as if were kubectl, but it has some logic to choose the version to execute. You should take care and ensure that you don't have any kubectl binary in your path. To check which binary you're executing, you can see it with:

$ which kubectl /opt/brew/bin/kubectl

When I enter "which kubectl" into terminal my output is:

/opt/homebrew/bin//kubectl

How would I fix this issue if this is indeed the issue? Or is it something else altogether?

Thanks for your help,

-Wes

alexppg commented 2 years ago

Hi! I do not use mac, so not really sure how to debug this.

@gtfortytwo have you actually tried to install kbenv? I made this recipes before using gorelease, which I use with particle, and the recipe actually compiles the program on your computer, so it should work with any OS. If you have tried to install it, does it show the same errors as @theweswing ?

Thanks for open the issues and sorry I have to ask for help for all mac related problems.

cbown75 commented 2 years ago

I have the same issue, same errors on an Intel based Mac.

alexppg commented 2 years ago

Could you please execute the next commands and show the outpit? It should be the same that brew executes, maybe it throws some light.

git clone https://github.com/little-angry-clouds/kubernetes-binaries-managers
cd kubernetes-binaries-managers
CGO_ENABLED=0 go build -a -o kbenv.bin cmd/kbenv/main.go

PD: You should have go installed if you tried to install kbenv, but if it fails you may need to install it manually with brew.

Gorcyn commented 2 years ago

Seems to be due to a broken build. @see golang #49219

For anyone wanting to work-around this problem:

Clone the repository:

❯ git clone https://github.com/little-angry-clouds/kubernetes-binaries-managers.git
Cloning into 'kubernetes-binaries-managers'...
remote: Enumerating objects: 652, done.
remote: Counting objects: 100% (72/72), done.
remote: Compressing objects: 100% (54/54), done.
remote: Total 652 (delta 25), reused 43 (delta 12), pack-reused 580
Receiving objects: 100% (652/652), 177.58 KiB | 1.24 MiB/s, done.
Resolving deltas: 100% (337/337), done.

Move into cloned sources:

❯ cd kubernetes-binaries-managers

Upgrade x/sys:

❯ go get -u golang.org/x/sys
go: downloading golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6
go: upgraded golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 => v0.0.0-20220503163025-988cb79eb6c6

Build:

❯ make build
go build -a -o bin/helmenv cmd/helmenv/main.go; \
    go build -a -o bin/helm-wrapper cmd/helm-wrapper/main.go; \
    go build -a -o bin/kbenv cmd/kbenv/main.go; \
    go build -a -o bin/kubectl-wrapper cmd/kubectl-wrapper/main.go; \
    go build -a -o bin/ocenv cmd/ocenv/main.go; \
    go build -a -o bin/oc-wrapper cmd/oc-wrapper/main.go;
go: downloading github.com/mitchellh/go-homedir v1.1.0
go: downloading github.com/spf13/cobra v1.0.0
go: downloading github.com/hashicorp/go-version v1.2.1
go: downloading k8s.io/client-go v0.17.0
go: downloading github.com/mholt/archiver/v3 v3.5.1-0.20210618180617-81fac4ba96e4
go: downloading github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5
go: downloading github.com/andybalholm/brotli v1.0.1
go: downloading github.com/golang/snappy v0.0.2
go: downloading github.com/klauspost/compress v1.11.4
go: downloading github.com/klauspost/pgzip v1.2.5
go: downloading github.com/nwaples/rardecode v1.1.0
go: downloading github.com/pierrec/lz4/v4 v4.1.2
go: downloading github.com/ulikunitz/xz v0.5.9
go: downloading github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8
go: downloading github.com/spf13/pflag v1.0.5
go: downloading github.com/imdario/mergo v0.3.5
go: downloading golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586
go: downloading golang.org/x/net v0.0.0-20191004110552-13f9640d40b9
go: downloading k8s.io/apimachinery v0.17.0
go: downloading k8s.io/klog v1.0.0
go: downloading github.com/golang/protobuf v1.3.2
go: downloading github.com/googleapis/gnostic v0.0.0-20170729233727-0c5108395e2d
go: downloading k8s.io/api v0.17.0
go: downloading golang.org/x/time v0.0.0-20190308202827-9d24e82272b4
go: downloading k8s.io/utils v0.0.0-20191114184206-e782cd3c129f
go: downloading github.com/gogo/protobuf v1.2.2-0.20190723190241-65acae22fc9d
go: downloading github.com/davecgh/go-spew v1.1.1
go: downloading github.com/google/gofuzz v1.0.0
go: downloading golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
go: downloading gopkg.in/yaml.v2 v2.2.4
go: downloading github.com/json-iterator/go v1.1.8
go: downloading github.com/modern-go/reflect2 v1.0.1
go: downloading sigs.k8s.io/yaml v1.1.0
go: downloading golang.org/x/text v0.3.2
go: downloading gopkg.in/inf.v0 v0.9.1
go: downloading github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd

Move binaries:

❯ cp ./bin/kbenv /usr/local/bin/kbenv
❯ cp ./bin/kubectl-wrapper /usr/local/bin/kubectl

Setup your desired kubectl version:

❯ kbenv install 1.22.4
Downloading binary...
Done! Saving it at /Users/ludo/.bin/kubectl-v1.22.4.

❯ kbenv use 1.22.4
Done! Using 1.22.4 version.

Enjoy:

❯ kubectl version
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"b695d79d4f967c403a96986f1750a35eb75e75f1", GitTreeState:"clean", BuildDate:"2021-11-17T15:48:33Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.4", GitCommit:"ba58f86b00f6b0f0b7694a75464aa7806f8bf6fc", GitTreeState:"clean", BuildDate:"2022-03-30T23:40:46Z", GoVersion:"go1.16.10", Compiler:"gc", Platform:"linux/amd64"}

@alexppg

Here is the requested output, without the upgrade:

❯ CGO_ENABLED=0 go build -a -o kbenv.bin cmd/kbenv/main.go
# golang.org/x/sys/unix
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/syscall_darwin.1_13.go:25:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.1_13.go:27:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.1_13.go:40:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:28:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:43:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:59:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:75:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:90:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:105:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:121:3: //go:linkname must refer to declared function or variable
../../go/pkg/mod/golang.org/x/sys@v0.0.0-20191026070338-33540a1f6037/unix/zsyscall_darwin_amd64.go:121:3: too many errors
alexppg commented 2 years ago

I'll close this in favor of this one since it has a more describing title. I'll update the problem there. https://github.com/little-angry-clouds/kubernetes-binaries-managers/issues/32