Intel app running on ARM launches Intel architecture of a universal app via NSTask

Hi,

So my app (which is a mix of C++ and Objective-C) is still not a universal build since it has a lot of C++ dependencies that need to be recompiled first. I'm using a NSTask to launch other processes from my app. Unfortunately the subprocess (even when the binary is universal) is launched via Rosetta and not natively (so the same as my app). What's the best solution to control the architecture of a spawned subprocess?

Thanks.

Replies

the subprocess … is launched via Rosetta and not natively

That’s expected. Once you’re in ‘Rosetta mode’, you stay in that mode.

There are a couple of ways to resolve this:

  • Switch to posix_spawn, which lets you select the architecture using posix_spawnattr_setarchpref_np.

  • Bounce through the arch command-line tool.

Personally, I’d probably do the latter (-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

  • That's what I thought as for expected. Thank you for your suggestions.

Add a Comment