origin icon indicating copy to clipboard operation
origin copied to clipboard

Not working in macOS Monterey

Open haibuiminh opened this issue 3 years ago • 11 comments

[provide a description of the issue]

Version

oc version v3.10, v3.8 macOS mentorey 12.0.1

Steps To Reproduce
  1. Just run oc version and recieve this issue in screen short
Current Result
Screen Shot 2021-10-30 at 4 58 46 PM
Expected Result

oc version works well, and I can do my business job

Additional Information

[try to run $ oc adm diagnostics (or oadm diagnostics) command if possible] [if you are reporting issue related to builds, provide build logs with BUILD_LOGLEVEL=5] [consider attaching output of the $ oc get all -o json -n <namespace> command to the issue] [visit https://docs.openshift.org/latest/welcome/index.html]

haibuiminh avatar Oct 30 '21 10:10 haibuiminh

Not exaclty a fix, but the version you can install with brew (openshift-cli) seems to work fine. I got the same error with this version.

gormers avatar Oct 31 '21 20:10 gormers

Not exaclty a fix, but the version you can install with brew (openshift-cli) seems to work fine. I got the same error with this version.

this worked for me

geisa-integrasi avatar Nov 01 '21 10:11 geisa-integrasi

I have installed Openshift-Cli with homebrew (v 4.6), but my server uses version 3.6.0 and I still get the issue with the message that is Error from server (NotAcceptable): the server was unable to respond with a content type that the client supports (get pods)

haibuiminh avatar Nov 01 '21 12:11 haibuiminh

Not exaclty a fix, but the version you can install with brew (openshift-cli) seems to work fine. I got the same error with this version.

Really strange but this also worked for me. I had previously installed by simply downloading from github releases and then copying over to usr/local/bin.

I had to delete the executable that I had copied over before installing from homebrew though.

b-zurg avatar Nov 03 '21 08:11 b-zurg

https://github.com/golang/go/wiki/MacOS12BSDThreadRegisterIssue

I have a hacky "fix" which works for me. Im only using a tiny subset of functionality though (getting tokens for pushing images and a couple of info commands) so not sure if this makes the entire oc binary work.

Im also on an intel mac so not sure if this will work for arm. docker is used to build all the tools so you will need docker up and running too.

git clone https://github.com/openshift/origin.git
cd origin
git checkout v3.11.0

Then patch hack/lib/build/binaries.sh to comment out the go install command

diff --git a/hack/lib/build/binaries.sh b/hack/lib/build/binaries.sh
index 7a5cbb5eb3..3fa2a028c3 100644
--- a/hack/lib/build/binaries.sh
+++ b/hack/lib/build/binaries.sh
@@ -233,13 +233,13 @@ os::build::internal::build_binaries() {
       fi

       if [[ ${#nonstatics[@]} -gt 0 ]]; then
-        GOOS=${platform%/*} GOARCH=${platform##*/} go install \
-          -pkgdir "${pkgdir}/${platform}" \
-          -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \
-          -ldflags="${local_ldflags}" \
-          "${goflags[@]:+${goflags[@]}}" \
-          -gcflags "${gogcflags}" \
-          "${nonstatics[@]}"
+        # GOOS=${platform%/*} GOARCH=${platform##*/} go install \
+        #   -pkgdir "${pkgdir}/${platform}" \
+        #   -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \
+        #   -ldflags="${local_ldflags}" \
+        #   "${goflags[@]:+${goflags[@]}}" \
+        #   -gcflags "${gogcflags}" \
+        #   "${nonstatics[@]}"

         # GOBIN is not supported on cross-compile in Go 1.5+ - move to the correct target
         if [[ $platform != $host_platform ]]; then
OS_BUILD_ENV_GOLANG=1.11 OS_ONLY_BUILD_PLATFORMS=darwin ./hack/build-release.sh

This will build the binaries for mac and dump them in _output/local/bin/darwin/ARCH

❯ l _output/local/bin/darwin/amd64/
.rwxr-xr-x 206M lee 16 Nov 10:57 hyperkube
.rwxr-xr-x 260M lee 16 Nov 10:57 hypershift
.rwxr-xr-x 107M lee 16 Nov 10:57 kubectl
.rwxr-xr-x 2.1M lee 16 Nov 10:57 oadm
.rwxr-xr-x 107M lee 16 Nov 10:57 oc
.rwxr-xr-x 240M lee 16 Nov 10:57 openshift
.rwxr-xr-x  28M lee 16 Nov 10:57 openshift-node-config
.rwxr-xr-x  66M lee 16 Nov 10:57 template-service-broker
oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth

Hope that helps!

Themodem avatar Nov 16 '21 11:11 Themodem

https://github.com/golang/go/wiki/MacOS12BSDThreadRegisterIssue

I have a hacky "fix" which works for me. Im only using a tiny subset of functionality though (getting tokens for pushing images and a couple of info commands) so not sure if this makes the entire oc binary work.

Im also on an intel mac so not sure if this will work for arm. docker is used to build all the tools so you will need docker up and running too.

git clone https://github.com/openshift/origin.git
cd origin
git checkout v3.11.0

Then patch hack/lib/build/binaries.sh to comment out the go install command

diff --git a/hack/lib/build/binaries.sh b/hack/lib/build/binaries.sh
index 7a5cbb5eb3..3fa2a028c3 100644
--- a/hack/lib/build/binaries.sh
+++ b/hack/lib/build/binaries.sh
@@ -233,13 +233,13 @@ os::build::internal::build_binaries() {
       fi

       if [[ ${#nonstatics[@]} -gt 0 ]]; then
-        GOOS=${platform%/*} GOARCH=${platform##*/} go install \
-          -pkgdir "${pkgdir}/${platform}" \
-          -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \
-          -ldflags="${local_ldflags}" \
-          "${goflags[@]:+${goflags[@]}}" \
-          -gcflags "${gogcflags}" \
-          "${nonstatics[@]}"
+        # GOOS=${platform%/*} GOARCH=${platform##*/} go install \
+        #   -pkgdir "${pkgdir}/${platform}" \
+        #   -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \
+        #   -ldflags="${local_ldflags}" \
+        #   "${goflags[@]:+${goflags[@]}}" \
+        #   -gcflags "${gogcflags}" \
+        #   "${nonstatics[@]}"

         # GOBIN is not supported on cross-compile in Go 1.5+ - move to the correct target
         if [[ $platform != $host_platform ]]; then
OS_BUILD_ENV_GOLANG=1.11 OS_ONLY_BUILD_PLATFORMS=darwin ./hack/build-release.sh

This will build the binaries for mac and dump them in _output/local/bin/darwin/ARCH

❯ l _output/local/bin/darwin/amd64/
.rwxr-xr-x 206M lee 16 Nov 10:57 hyperkube
.rwxr-xr-x 260M lee 16 Nov 10:57 hypershift
.rwxr-xr-x 107M lee 16 Nov 10:57 kubectl
.rwxr-xr-x 2.1M lee 16 Nov 10:57 oadm
.rwxr-xr-x 107M lee 16 Nov 10:57 oc
.rwxr-xr-x 240M lee 16 Nov 10:57 openshift
.rwxr-xr-x  28M lee 16 Nov 10:57 openshift-node-config
.rwxr-xr-x  66M lee 16 Nov 10:57 template-service-broker
oc version
oc v3.11.0+0cbc58b
kubernetes v1.11.0+d4cacc0
features: Basic-Auth

Hope that helps!

Thanks for this, really! Took me hours to get here. 🥳 🚀

patchon avatar Jan 27 '22 15:01 patchon

Hi Everyone,

I am running to this error while doing this OS_BUILD_ENV_GOLANG=1.11 OS_ONLY_BUILD_PLATFORMS=darwin ./hack/build-go.sh

I can't find build-release.sh in hack directory.

what am I missing here? Can someone please help me?

/oc_3.11/origin/hack/lib/constants.sh: line 83: KUBE_GIT_MAJOR: unbound variable

[ERROR] hack/lib/constants.sh:83: ldflags+=($(os::build::ldflag "${OS_GO_PACKAGE}/vendor/k8s.io/component-base/version.gitMajor" "${KUBE_GIT_MAJOR}")) exited with status 1. [ERROR] hack/lib/build/binaries.sh:160: version_ldflags=$(os::build::ldflags) exited with status 1. [ERROR] hack/lib/build/binaries.sh:144: ( os::build::internal::build_binaries "${binaries[@]+"${binaries[@]}"}" ) exited with status 1. [ERROR] hack/build-go.sh exited with code 1 after 00h 00m 02s

git diff of hack/lib/build/binaries.sh

       if [[ ${#nonstatics[@]} -gt 0 ]]; then
-        GOOS=${platform%/*} GOARCH=${platform##*/} go install \
-          -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \
-          -ldflags="${local_ldflags}" \
-          "${goflags[@]:+${goflags[@]}}" \
-          -gcflags "${gogcflags}" \
-          "${nonstatics[@]}"
+     #   GOOS=${platform%/*} GOARCH=${platform##*/} go install \
+     #     -tags "${OS_GOFLAGS_TAGS-} ${!platform_gotags_envvar:-}" \
+     #     -ldflags="${local_ldflags}" \
+     #     "${goflags[@]:+${goflags[@]}}" \
+     #     -gcflags "${gogcflags}" \
+     #     "${nonstatics[@]}"

kshitij241 avatar Jan 27 '22 16:01 kshitij241

@Themodem thanks for the workaround! After doing brew install go then following your steps, I now have an 'oc' binary that works.

JtMotoX avatar Mar 10 '22 19:03 JtMotoX

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle stale

openshift-bot avatar Jun 09 '22 00:06 openshift-bot

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle rotten /remove-lifecycle stale

openshift-bot avatar Jul 09 '22 01:07 openshift-bot

/remove-lifecycle rotten

JtMotoX avatar Jul 09 '22 01:07 JtMotoX

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle stale

openshift-bot avatar Oct 07 '22 09:10 openshift-bot

Stale issues rot after 30d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle rotten. Rotten issues close after an additional 30d of inactivity. Exclude this issue from closing by commenting /lifecycle frozen.

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

/lifecycle rotten /remove-lifecycle stale

openshift-bot avatar Nov 07 '22 00:11 openshift-bot

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen. Mark the issue as fresh by commenting /remove-lifecycle rotten. Exclude this issue from closing again by commenting /lifecycle frozen.

/close

openshift-bot avatar Dec 07 '22 08:12 openshift-bot

@openshift-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.

Reopen the issue by commenting /reopen. Mark the issue as fresh by commenting /remove-lifecycle rotten. Exclude this issue from closing again by commenting /lifecycle frozen.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

openshift-ci[bot] avatar Dec 07 '22 08:12 openshift-ci[bot]