2

At the request of some PPC users, I'm trying to create a PPC-compatible installer package of some open source software. Naturally, this requires compiling a PPC binary. I have a Leopard Virtual Machine set up on my Intel Mac, but I don't have access to any actual PPC hardware.

MacPorts does not offer any C++11 compilers which can cross-compile PPC binaries on Intel, but I'd thought I'd be able to work around this by running the whole of MacPorts under Rosetta. With Rosetta 2, this would be easy—I'd just set the Terminal app to "Open using Rosetta", and everything the Terminal runs would also use Rosetta. This was a commonly recommended way to run Homebrew on M1 Macs, before Homebrew finally added native Apple Silicon support a few weeks ago.

Unfortunately, Rosetta 1 does not appear to be this intelligent. I can set the Terminal app to "Open using Rosetta," but this causes only the literal Terminal app to use Rosetta. Bash, MacPorts, etc are still running as Intel processes, according to Activity Monitor.

Is there an alternate way to run command line programs—and preferably all of MacPorts—under Rosetta?

6
  • I'm just amazed that there are numbers of PPC users requesting anything, let alone the same thing. ;-)
    – benwiggy
    Mar 7, 2021 at 10:16
  • Which open source software? Macports probably has a port for it. If you setup macports to build universal it will build each executable with multiple architectures - for older OSX versions this will be i386 and ppc. Thjs does not use rosetta at all , just Apple's tools that can build multiple architectures
    – mmmmmm
    Mar 7, 2021 at 11:43
  • @mmmmmm Squid4, which needs C++11 to build. MacPorts cannot build C++11 software universal for PPC and x86. trac.macports.org/ticket/62332#comment:2 Mar 7, 2021 at 14:40
  • 1
    @benwiggy In this case, the point of the package is to fix https issues on older OS's, so it kind of makes sense. forums.macrumors.com/threads/… I've gotten around ten emails, not hundreds. :) Mar 7, 2021 at 14:43
  • Macports squid4 port seems to build ports.macports.org/port/squid4/builds on 10.5 ppc
    – mmmmmm
    Mar 8, 2021 at 13:09

2 Answers 2

4

Provided you're on a system where Rosetta v1 is available (up to and including Mac OS X 10.6), you can direct the system to execute the ppc segment of a universal binary using the arch command.

/usr/bin/arch -arch ppc /path/to/some/executable

I've found it useful to keep a virtual machine in Parallels Desktop running OS X Server 10.6 with Xcode and other developer tools installed for this scenario, of compiling older software for obsolete PowerPC Mac systems.

1

On Leopard and Snow Leopard, you can and should use the arch command. Unfortunately, this command does not exist on Tiger. (Well, the arch program exists, but all it can do is print your current cpu architecture.)

Instead, on Tiger you can use the translate binary directly:

/usr/libexec/oah/translate /path/to/some/executable

Note that you need to include the full path to the executable. If the executable doesn't exist (or you ignored the prior sentence), translate will fail with a very unhelpful segmentation fault.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .