Skip to content
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

Implement support for macOS Apple Silicon => x86_64 cross compilation #2958

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

fhanau
Copy link
Collaborator

@fhanau fhanau commented Oct 19, 2024

I hope to use this in CI in the near future to compile x86 release binaries on Apple Silicon to make this process faster and have access to the latest compiler version. That can be discussed in detail on another issue.

@fhanau fhanau changed the title [EXP] Support macOS arm64 => x86_64 cross compilation Implement support for macOS Apple Silicon => x86_64 cross compilation Oct 19, 2024
@fhanau
Copy link
Collaborator Author

fhanau commented Oct 19, 2024

  • The PR currently adds a test job that cross-compiles to x86 on the arm64-based and then runs the tests via Rosetta. This is solely to demonstrate that this change works, remove it before merging.

For macOS-based reviewers who want to try this out locally, bazel test --config=macos-cross-x86_64 //src/workerd/util:sqlite-test && file bazel-bin/src/workerd/util/sqlite-test is a good way to compile a test binary and confirm that it is compiled for x86, without having to recompile everything.

@fhanau fhanau requested a review from danlapid October 21, 2024 13:28
@fhanau fhanau marked this pull request as ready for review October 21, 2024 13:29
@fhanau fhanau requested review from a team as code owners October 21, 2024 13:29
@fhanau fhanau requested a review from jasnell October 21, 2024 13:29
@danlapid
Copy link
Contributor

Love it!
Any chance you want to take the same opportunity to add a build step to release.yml so we can remove the internal runner for macos arm64?

Copy link
Member

@npaun npaun left a comment

Choose a reason for hiding this comment

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

Cool

@fhanau
Copy link
Collaborator Author

fhanau commented Oct 21, 2024

Love it! Any chance you want to take the same opportunity to add a build step to release.yml so we can remove the internal runner for macos arm64?

That is something I have in mind (#2884 was a step in that direction), but it merits some discussion internally first – based on https://docs.github.com/en/actions/administering-github-actions/usage-limits-billing-and-administration#usage-limits we are limited to 5 concurrent macOS build jobs across the cloudflare org. We have encountered macOS runner exhaustion for workerd before. Adding a second release job on GitHub will not add much overhead (Apple Silicon macOS is the fastest free tier runner) but might be enough to make us hit runner exhaustion again occasionally and have macOS builds stall.

@danlapid
Copy link
Contributor

As you’ve mentioned, I don’t think that the release build runs often enough. I think we should go ahead with it.
As Steve mentioned in an internal conversation, GitHub limits are something he’s working on, I don’t think we should work too hard to engineer around them.

@fhanau
Copy link
Collaborator Author

fhanau commented Oct 21, 2024

As you’ve mentioned, I don’t think that the release build runs often enough. I think we should go ahead with it. As Steve mentioned in an internal conversation, GitHub limits are something he’s working on, I don’t think we should work too hard to engineer around them.

👍 Let's discuss at the team meeting

@fhanau fhanau merged commit 1dee401 into main Oct 21, 2024
10 checks passed
@fhanau fhanau deleted the felix/macOS-cross branch October 21, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants