Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#61430 closed enhancement (fixed)

Allow x86_64 ports to be used on arm64 hardware via Rosetta 2

Reported by: ryandesign (Ryan Carsten Schmidt) Owned by: jmroot (Joshua Root)
Priority: Normal Milestone: MacPorts 2.6.4
Component: base Version:
Keywords: Cc: michaelld (Michael Dickens)
Port:

Description

On an Apple Silicon machine if I try to install a port that specifies supported_archs that includes x86_64 but does not include arm64, the error is e.g.:

Error: iTerm2 cannot be installed for the configured build_arch 'arm64' because it only supports the arch(s) 'x86_64'.

Instead, it should allow the installation to proceed, and install all of the port's dependencies universal, so that the software can be used via Rosetta 2.

This would match how we allowed PowerPC apps to run on Intel Macs via Rosetta.

Change History (9)

comment:1 Changed 3 years ago by michaelld (Michael Dickens)

Yes! I've done this with quite a few ports and in my limited testing they work the same on ARM64 as on x86_64. I use gh a lot, and it works quite well on ARM64 with this small tweak to the Portfile. I'd love to see it natively built, but there is a whole chain of dependencies to fix for ARM64 ... so, this solution is way and by far the fastest to get ARM64 support for many current ports that otherwise will take months to get working.

comment:2 Changed 3 years ago by michaelld (Michael Dickens)

Cc: michaelld added

comment:3 in reply to:  description Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to ryandesign:

This would match how we allowed PowerPC apps to run on Intel Macs via Rosetta.

Am I misremembering? I thought we allowed that, but trying to install a ppc-only port on 10.6 I get:

Error: graphviz-oldgui cannot be installed for the configured build_arch 'x86_64' because it only supports the arch(s) 'ppc'.

comment:4 Changed 3 years ago by jmroot (Joshua Root)

You could certainly set build_arch (or configure.build_arch) to ppc on Intel machines with Rosetta, but we never auto-demoted the value like we do x86_64 to i386 or ppc64 to ppc.

comment:5 in reply to:  4 ; Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Replying to jmroot:

You could certainly set build_arch (or configure.build_arch) to ppc on Intel machines with Rosetta,

You mean the user on the command line? Or the portfile author in the portfile? (And I'm never going to remember the difference between those two variables...)

but we never auto-demoted the value like we do x86_64 to i386 or ppc64 to ppc.

Do you think that would be easy to add? I thought when I started this that I would just be adding another case to the existing ppc-on-i386 case, but if we don't have that then I'm not sure where to look.

comment:6 in reply to:  5 Changed 3 years ago by jmroot (Joshua Root)

Replying to ryandesign:

Replying to jmroot:

You could certainly set build_arch (or configure.build_arch) to ppc on Intel machines with Rosetta,

You mean the user on the command line? Or the portfile author in the portfile? (And I'm never going to remember the difference between those two variables...)

The user could potentially set either one on the command line, the author could set configure.build_arch in the portfile, and the user could set build_arch in macports.conf.

but we never auto-demoted the value like we do x86_64 to i386 or ppc64 to ppc.

Do you think that would be easy to add? I thought when I started this that I would just be adding another case to the existing ppc-on-i386 case, but if we don't have that then I'm not sure where to look.

Yes, it's pretty straightforward. I think the i386->ppc demotion didn't exist just because the code was added during the 64-bit transition. IIRC build_arch itself was only added around the time of the Intel transition.

comment:7 Changed 3 years ago by jmroot (Joshua Root)

Owner: set to jmroot
Resolution: fixed
Status: newclosed

In 94f428eda6bd58b57c670c20fb2362ad7012310a/macports-base (master):

extend possible demotions in choose_supported_archs

Allow switching to x86_64 when arm64 is not supported, and to ppc when
i386 is not supported.

Fixes: #61430

comment:8 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)

Ooh, thank you!

comment:9 Changed 3 years ago by jmroot (Joshua Root)

Milestone: MacPorts 2.6.4
Note: See TracTickets for help on using tickets.