"Architecture 'arm64' is not supported" error on Apple M1 with core22 base

Hi,

I’m on a Apple M1 silicon based MacBook Pro / arm64 and was glad to see that multipass now supports Apple Silicon since version 1.12.

Using the latest hombrew available versions of multipass (1.12.0) and snapcraft (7.3.1) I however got the following error when using base: core22:

Traceback (most recent call last):
[...]
  File "/opt/homebrew/Cellar/snapcraft/7.3.1/libexec/lib/python3.11/site-packages/craft_parts/infos.py", line 268, in _set_machine
    raise errors.InvalidArchitecture(self._host_arch)
craft_parts.errors.InvalidArchitecture: Architecture 'arm64' is not supported.
Make sure the architecture name is correct.

I noticed however that changing base to core20 makes the build go through.

What’s going on here?

Full config here:

name: x
base: core22
architectures:
  - arm64
version: '0.1'
summary: My snap
description: Snap description

grade: devel # must be 'stable' to release into candidate/stable channels
confinement: devmode # use 'strict' once you have the right plugs and slots

parts:
  x:
    plugin: rust
    build-packages: [cargo, rustc]
    source: .

apps:
  x:
    command: bin/x
    daemon: simple

sadly the snapcraft.yaml syntax changes with every base update, architectures: simply needs a different syntax with core22

But the shorthand syntax I used is still supported, right? I tried using the full syntax with build-on + build-for, but that still gives the same error.

build-for is not supported anymore … it is:

architectures:
  - build-on: [arm64]
    run-on: [arm64]

My reading of the migration guide and the comments is that it’s the other way around.

Either way the shorthand syntax I used should translate to the correct syntax, right…?

i’m not sure the shorthand syntax from the initial post is supported at all anymore …

architectures:
  - build-on: [arm64]

might be the shortest that is still possible (untested though)

Doesn’t work.

There’s something else going on, as I can build this just fine on a raspberry pi 4 and on a cloud arm64 instance.

@saviq are there known bugs in this area with multipass on M1/2 ?

Not @Saviq anymore, but me :wink: But no, we fixed this in Multipass 1.12 and the error is spit out by Snapcraft. It seems perhaps Snapcraft is selectively filtering out arm64 support with core22 base when using Multipass???

1 Like

I reproduced this on a Mac M1 with and without the architectures keyword.

It looks like the python call platform.machine() returns arm64 where craft-parts is expecting it to be aarch64.

4 Likes

Thanks for the report, we’re tracking this here: https://github.com/snapcore/snapcraft/issues/4211

2 Likes

Great, thanks for the investigation!