-
Notifications
You must be signed in to change notification settings - Fork 419
fix(makefile): work OOTB on macOS #2137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ben Dronen <[email protected]>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dronenb The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
WalkthroughThe PR addresses a macOS build failure by adding Darwin-specific compiler configuration that sets Heimdal header paths when the gssapi tag is used, and reformats a Makefile build flag assignment to a single-line form. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Assessment against linked issues
Out-of-scope changesNo out-of-scope changes identified. The reformatting of ✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Cache: Disabled due to data retention organization setting Knowledge base: Disabled due to 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**⚙️ CodeRabbit configuration file
Files:
🔇 Additional comments (2)
Comment |
|
Hi @dronenb. Thanks for your PR. I'm waiting for a github.com member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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-sigs/prow repository. |
|
/ok-to-test |
|
@dronenb: all tests passed! Full PR test history. Your PR dashboard. 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-sigs/prow repository. I understand the commands that are listed here. |
| export CGO_CFLAGS := -I$(HOMEBREW_PREFIX)/opt/heimdal/include | ||
| endif | ||
| endif | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is gonna fail on Windows, right?
I am wondering whether just documenting the issue in README wouldn't suffice TBH. But feel free to come up with a cross-platform way to improve this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am actually not sure how much we support Windows TBH 😅 Perhaps @ardaguclu knows better.
I would also like to understand first why my setup worked out of the box. I would prefer for the user to set up their env so that the lib is found just fine instead of us handling the env in the Makefile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this would affect Windows at all, since this only applies to Darwin, happy to test it though.
if we wanted users to setup their environment, I imagine that would mean including pkg-config in some capacity? I think this route would be the simplest...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional will only work for Darwin. So this won't affect Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am honestly bit of a greenhorn regarding Windows, so I was not sure whether uname is even available there. But I guess we require some core UNIX-like utils to be installed. Never mind.
ardaguclu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for filing and fixing this. Dropped a few comments.
| -X k8s.io/client-go/pkg/version.gitCommit="$(SOURCE_GIT_COMMIT)" \ | ||
| -X k8s.io/client-go/pkg/version.buildDate="$(shell date -u +'%Y-%m-%dT%H:%M:%SZ')" \ | ||
| -X k8s.io/client-go/pkg/version.gitTreeState="$(SOURCE_GIT_TREE_STATE)" | ||
| GO_LD_EXTRAFLAGS := -X k8s.io/component-base/version.gitMajor="1" \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the changes in here.
| # Fix for macOS GSSAPI compatibility when gssapi tag is used | ||
| # macOS system headers lack RFC 5587 support. Use Homebrew's heimdal for proper headers. | ||
| # See vendor/github.com/apcera/gssapi/name.go for details. | ||
| ifeq ($(shell uname),Darwin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
make oc uses GO_BUILD_FLAGS (line:35) which includes gssapi dependecy. However, if you see darwin build flags (i.e. GO_BUILD_FLAGS_DARWIN, line:36), it does not have gssapi.
Could you please test make oc by removing gssapi from GO_BUILD_FLAGS?. If the build succeeds, it would be great if you can try to use oc login. If oc login works too, I believe that we can modify GO_BUILD_FLAGS by removing gssapi, if the host is darwin.
| ifeq ($(shell uname),Darwin) | ||
| ifneq (,$(findstring gssapi,$(GO_BUILD_FLAGS))) | ||
| HOMEBREW_PREFIX := $(shell brew --prefix) | ||
| export CGO_CFLAGS := -I$(HOMEBREW_PREFIX)/opt/heimdal/include |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that we don't need this at all on macos.
| export CGO_CFLAGS := -I$(HOMEBREW_PREFIX)/opt/heimdal/include | ||
| endif | ||
| endif | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional will only work for Darwin. So this won't affect Windows.
The README instructs to install
heimdallviabrewto build on macOS. However, this alone is insufficient. This change detects if you are building on macOS and have thegssapitag, and if so, determines yourbrewprefix,, and includes the heimdall headersFixes #2136