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

Support universal binaries #10307

Closed
dcow opened this issue Jan 12, 2021 · 3 comments
Closed

Support universal binaries #10307

dcow opened this issue Jan 12, 2021 · 3 comments
Labels
outdated PR was locked due to age

Comments

@dcow
Copy link
Contributor

dcow commented Jan 12, 2021

Feature suggestion

I know there's been discussion on how to support arm64e Apple Silicon. However in the few threads that I read, I never saw the option for fat binaries come up. I want to have some discussion about the possibility.

To be clear: moving homebrew to opt is not the issue. That's all fine and well. However, maintaining two installs of homebrew during what will likely be a years long transition phase will become unwieldy and cumbersome. And I think we might have underestimated the length of the period during which we'll need to support multiple architectures. Consider somebody who bought an Intel MacBook Pro today. They expect to use that machine for more than a few years regardless of whether there's broad arm support or not.

It's also informative to point out that this is how Apple is packaging its sowftware for macOS. Here's Apple-provided git:

% file $(which git)
/usr/bin/git: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/git (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/git (for architecture arm64e): Mach-O 64-bit executable arm64e

It's possible some users would not want large files by default (although it's what they get with xcode-select --install, so they don't have much choice from that angle). However, I suspect most users would rather manage a single brew install with fat binaries for the interim than two independent package managers.

A detailed description of the proposed feature

Essentially, add support, either by default or with a config option/switch, for --universal-bottles and associated universal formula (to build from source).

During the bottling stage, the lipo tool can be used to combine two mach-o files of different architectures into one "fat" file containing both.

The motivation for the feature

Users should not have to worry about whether they launch a program using rosetta or natively. Such a user experience feels closer to the route Apple is taking to manage the transition, and disc space is not a pressing concern these days.

How the feature would be relevant to at least 90% of Homebrew users

I suspect this would remove the cognative load of managing multiple homebrew installs and environments for the majority of users during the transition from x86_64 to arm64e.

What alternatives to the feature have been considered

I think a type of alternative is already in place and proving to be confusing: #10302.

@carlocab
Copy link
Member

Related discussion here, for anyone else who hasn't see it yet: Homebrew/discussions#412

@dcow
Copy link
Contributor Author

dcow commented Jan 12, 2021

I'll add a similar implementation suggestion here:

If the worry is having to rework CI to build growlers instead of the traditional bottles, and also a general desire to avoid overconsumption if not needed, then perhaps brew could perform the lipo operation at at install time (if the user requests it and if bottles for the requested architectures are available), locally.

@MikeMcQuaid
Copy link
Member

Previous discussion: #9454

Essentially, add support, either by default or with a config option/switch, for --universal-bottles and associated universal formula (to build from source).

By default will double the built time and require changes in almost every formula for this to work.

With a config option will be error-prone (as it's not tested in CI) and get broken regularly. We used to do this. It sucked for both maintainers (more support requests) and users (it was regularly broken).

then perhaps brew could perform the lipo operation at at install time (if the user requests it and if bottles for the requested architectures are available), locally.

This won't work for any non-cellar :any bottles because they will reference different Homebrew prefixes.

Sorry but: passing on this due to the above.

@BrewTestBot BrewTestBot added the outdated PR was locked due to age label Feb 13, 2021
@Homebrew Homebrew locked as resolved and limited conversation to collaborators Feb 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

No branches or pull requests

4 participants