Skip to content

Go: Fix makefile to use bash to look up bazel path. #17821

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

Merged
merged 2 commits into from
Oct 22, 2024

Conversation

criemen
Copy link
Collaborator

@criemen criemen commented Oct 22, 2024

On Windows, make's path resolution algorithm is incorrect. It picks up a bazel.exe in PATH that's after a bazel binary. In particular, on actions, the non-exe binary is a bazelisk instance, whereas bazel.exe is a bazel (at the current time 7.3.2) installation.
This means we pick up the wrong bazel version, and if the differences between the bazel we want and that we actually get are too big, the build fails.

Thanks to @smowton and @redsun82 for debugging help!

On Windows, make's path resolution algorithm is incorrect.
It picks up a bazel.exe in PATH that's _after_ a bazel binary.
In particular, on actions, the non-exe binary is a bazelisk
instance, whereas bazel.exe is a bazel (at the current time 7.3.2)
installation.
This means we pick up the wrong bazel version, and
if the differences between the bazel we want and that we actually
get are too big, the build fails.
@github-actions github-actions bot added the Go label Oct 22, 2024
@criemen criemen marked this pull request as ready for review October 22, 2024 09:02
@criemen criemen requested a review from a team as a code owner October 22, 2024 09:02
@@ -1,3 +1,5 @@
BAZEL := $(shell bash -c "which bazel")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth a small comment pointing out the windows make binary resolution bug, or someone in the future might revert this thinking "why not use bazel directly?"

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

argh I thought I did that, I wanted to do that, and apparently all I did was writing the commit explanation. I'm clearly too tired.

@criemen criemen requested a review from redsun82 October 22, 2024 09:26
Copy link
Member

@mbg mbg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @criemen for noticing, and @redsun82 for figuring it out!

@criemen criemen merged commit cdffa09 into main Oct 22, 2024
12 checks passed
@criemen criemen deleted the criemen/win-make-bazel branch October 22, 2024 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants