M1 Mac Support in ARM64 w/o Rosetta

I’ve searched a bit and the official guidance seems to be that ARM64 on M1 is natively supported, but that hasn’t exactly been my experience after testing recently. I would like to know if compiling should work without Rosetta, or if I need to install and emulate with Rosetta. If I need to currently use Rosetta, are there plans to make it work natively in the future?

I have:

  • Apple M1 Pro running macOS Monterey 12.2
  • VSCode 1.64.2 (Universal)
  • PlatformIO v5.2.5.
  • Device platform is an ESP32, platform-espressif32 v3.2.1 and v3.5.0.

I’ve attempted to replace CMake with v3.22.2, but then it also complains about Ninja.

Error output:

OSError: [Errno 86] Bad CPU type in executable: '/Users/me/.platformio/packages/tool-cmake/bin/cmake':
  File "/Users/me/.platformio/penv/lib/python3.8/site-packages/platformio/builder/main.py", line 181:
    env.SConscript("$BUILD_SCRIPT")
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/Users/me/.platformio/platforms/espressif32/builder/main.py", line 233:
    target_elf = env.BuildProgram()
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "/Users/me/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 61:
    env.ProcessProgramDeps()
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "/Users/me/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 128:
    env.BuildFrameworks(env.get("PIOFRAMEWORK"))
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Util.py", line 742:
    return self.method(*nargs, **kwargs)
  File "/Users/me/.platformio/penv/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 343:
    SConscript(env.GetFrameworkScript(f), exports="env")
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 660:
    return method(*args, **kw)
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 597:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/Users/me/.platformio/packages/tool-scons/scons-local-4.3.0/SCons/Script/SConscript.py", line 285:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/Users/me/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 1159:
    project_codemodel = get_cmake_code_model(
  File "/Users/me/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 209:
    run_cmake(src_dir, build_dir, extra_args)
  File "/Users/me/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 678:
    run_tool(cmd)
  File "/Users/me/.platformio/platforms/espressif32/builder/frameworks/espidf.py", line 633:
    result = exec_command(cmd, env=idf_env)
  File "/Users/me/.platformio/penv/lib/python3.8/site-packages/platformio/proc.py", line 114:
    with subprocess.Popen(*args, **kwargs) as p:
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 858:
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/subprocess.py", line 1704:
    raise child_exception_type(errno_num, err_msg, err_filename)

Per https://api.registry.platformio.org/v3/packages/platformio/tool/tool-cmake one package, tool-cmake-darwin_x86_64-3.21.3.tar.gz, is valid for both x86_x64 and arm64. The only way that that can be true is if it’s a x86_x64 and uses Rosetta for ARM64 support.

So this is still a problem one year later… is anyone working on it or do we have to accept that Rosetta is still a requirement?

Just curious, why it’s not OK to just go with Rosetta?

I don‘t want unadjusted programs to just run (slower, and with problems) without notice. Without Rosetta installed, I immediately get aware of the missing arm slice.

Rosetta isn’t that bad. I myself is also using Apple Silicon, been on M1 Max for the last a year and a half, while also doing some ESP32 projects. There’s never been a problem caused by Rosetta, or running x86_64 binaries on aarch64, that has occurred to me. Also, the translation layer won’t deplete speed that much - in most cases it’s unnoticeable. I mean, this is the price we aarch64 pioneers have to pay. And last, if you really hate translation layer that much, you can always compile your own toolchain.