Why has Universal x86_64/arm64e support been so difficult? #412
-
I got an M1 mac (I was trying to get an Intel and didn't realize the ARM versions started shipping already, but that's another story), and I was disappointed to find that Homebrew didn't work out-of-the-box. If I run I know it's possible, I was pleasantly surprised to find that all of Apple's tools (
Is it really that difficult to add Universal binary support for Homebrew? |
Beta Was this translation helpful? Give feedback.
Replies: 9 comments 52 replies
-
I’m not familiar with the details, but I believe offering universal binaries is very difficult. From my understanding Homebrew used to provide universal 32/64-bit binaries, when Apple still supported 32-bit machines. Things broke a lot. |
Beta Was this translation helpful? Give feedback.
-
Short answer: yes. If it was easy, we would have just done it. Take a look at Homebrew/brew#7857 to see just a snippet of the huge amount of work that's been done. The good news, we're just about ready to officially announce support. You can choose to start using Homebrew natively or wait a few more days for official support. No date yet but soon. |
Beta Was this translation helpful? Give feedback.
-
@carlocab I'm curious as to a technical reason. Or at least a few examples, if it's a lot of little things.
Shipping Universal binaries is the solution Apple is pushing. It's obvious they've put a lot of investment into getting it to work. With my intermediate level of knowledge, it's the first solution I would try to deploy. I'm curious what the roadblock is, so to speak. It sounds like nobody's even tried it. And it's not like shipping a Universal binary is without benefit. If I could run |
Beta Was this translation helpful? Give feedback.
-
From my (admittedly limited) understanding, shipping a universal binary requires either:
Both are fragile and tricky to get right. (Doing either also introduces unnecessary complexity in Homebrew's CI workflows.) It's doable for a piece of software that you designed yourself and understand intimately. But for around 5000 different software packages, most of which you don't even know how to use? You're going to need a team of engineers working overtime for a while. (You're probably going to have to pay them too. That's not cheap.)
That's because it's not even worth trying. It's a lot of hard work and effort in exchange for dubious benefit. If I had an application that already contained code that was native for my system, why would I want to keep the pieces that either
I know the word "universal" sounds fancy and exciting. Universal binaries are intended to simplify the distribution of software because it takes away the need to reliably check the architecture of the target platform. Homebrew, however, already has existing methods in place for checking system architecture, and so has zero need to take advantage of this simplification of distribution, especially not with its attendant complications. |
Beta Was this translation helpful? Give feedback.
-
other package management systems for macOS do offer universal arm64/x86_64 installs. |
Beta Was this translation helpful? Give feedback.
-
This misses the nuance of what Apple is providing with rosetta2 a bit. It's not a lazy hack deployed to forgo the need to check target architecture. It's a feature that allows a machine to execute code compiled for either architecture. Current macOS systems with rosetta2 installed actually execute both architectures. They don't just consume the fat binaries only to use the aarch64e slice. This is required because it will be awhile before all software has native support for aarch64e. So if your terminal emulator is running under rosetta2 then everything it executes will be intel as well. And that's actually a feature... imagine developing software that is portable and wanting to debug the x86 version. Rosetta lets you do that. Of course I want all my binaries to run natively on Apple silicon. However, I don't see us getting to that world for more than a few years. Think of people who just bought an Intel Macbook. They're not going anywhere anytime soon. And they will need x86_64 software for the lifetime of their machine. Requiring people maintain multiple installs of |
Beta Was this translation helpful? Give feedback.
-
It's also worth noting: brew doesn't have to even bottle fat binaries in its CI. M1 installs of brew could, at package install time on the local system, download both bottles (if available and requested by the user) and then |
Beta Was this translation helpful? Give feedback.
-
If there isn't an intent to ever support universal binaries, would it be possible to at least have a sanctioned path for installing arm64 packages (preferably in the same locations that arm64 homebrew would install them at) on an x86 host with an x86 install of homebrew? The current setup makes it very difficult to setup a cross compiling x86_64 to ARM environment (for compiling your own universal binaries) if you were using homebrew for installing your library dependencies. |
Beta Was this translation helpful? Give feedback.
-
I'm going to lock this as we seem to be circling back to the same points over and over again. See my response in #412 (reply in thread) for why we won't be supporting universal binaries. |
Beta Was this translation helpful? Give feedback.
I'm going to lock this as we seem to be circling back to the same points over and over again. See my response in #412 (reply in thread) for why we won't be supporting universal binaries.