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

Add --host_macos_cpus flag #13461

Closed
wants to merge 1 commit into from

Conversation

keith
Copy link
Member

@keith keith commented May 10, 2021

When your macOS build has tools that build with the Apple rules, such as
macos_command_line_application, you likely want to share caches
between Apple Silicon and Intel machines. Today your tool would build
for the host architecture (ideally, see #13440)
which means the tools would differ between the different architectures,
leading to split caches. This flag allows you to pass
--host_macos_cpus=arm64,x86_64 in order to produce a fat binary for
host tools. This has the downside of increasing binary size for your
tools, but likely that trade-off is worth it for almost everyone versus
having split caches.

When your macOS build has tools that build with the Apple rules, such as
`macos_command_line_application`, you likely want to share caches
between Apple Silicon and Intel machines. Today your tool would build
for the host architecture (ideally, see bazelbuild#13440)
which means the tools would differ between the different architectures,
leading to split caches. This flag allows you to pass
`--host_macos_cpus=arm64,x86_64` in order to produce a fat binary for
host tools. This has the downside of increasing binary size for your
tools, but likely that trade-offs is worth it for almost everyone versus
having split caches.
@keith
Copy link
Member Author

keith commented May 10, 2021

Here's an example alternative for macos_command_line_application specifically bazelbuild/rules_apple#1155

@lberki lberki requested review from allevato and removed request for lberki May 11, 2021 06:21
@allevato allevato requested a review from dmaclach May 12, 2021 14:09
@allevato
Copy link
Member

@dmaclach Any concerns here?

@brentleyjones
Copy link
Contributor

I wanted to make sure my comment on the other PR was seen here as well: bazelbuild/rules_apple#1155 (comment)

@brentleyjones
Copy link
Contributor

@dmaclach @allevato Friendly ping 🤗

@brentleyjones
Copy link
Contributor

This is also very useful for remote execution, being able to have the host and remote executor be on differing architectures.

@keith keith marked this pull request as draft July 1, 2021 22:44
@brentleyjones
Copy link
Contributor

Seems this is needed to get bazelbuild/rules_apple@73c041d to work for host tools.

@thii
Copy link
Member

thii commented Nov 16, 2021

Can we please have this in? Although it's possible to do this with Starlark, it's a pain to update the rules everywhere; if we have this, it would be just a single flip.

@keith
Copy link
Member Author

keith commented Nov 16, 2021

Last I checked it required more changes to work

@sgowroji
Copy link
Member

Hello @keith, Could you please confirm whether all the required changes are added in this PR ? Asking you this query with respect to the comment mentioned here. So that i can request for review and try for merge.

@sgowroji sgowroji added the awaiting-user-response Awaiting a response from the author label Apr 20, 2022
@keith
Copy link
Member Author

keith commented Jan 10, 2023

dropping this for now, not sure if we really need anymore or not, we can bring back up if needed

@keith keith closed this Jan 10, 2023
@keith keith deleted the ks/add-host_macos_cpus-flag branch January 10, 2023 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting-user-response Awaiting a response from the author cla: yes platform: apple team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants