Two snap files will be created: my-snap_1.0_amd64.snap and my-snap_1.0_arm64.snap.
If snapcraft executes on an arm64 machine, then it will create the following build plan:
Created build plan:
build-on: arm64 build-for: arm64
One snap file will be created: my-snap_1.0_arm64.snap.
This build plan can be filtered with the environment variable SNAPCRAFT_BUILD_FOR=<arch> or the command-line argument --build-for=<arch>. The command-line argument takes priority over the environment variable. In the example above, using --build-for=arm64 would cause snapcraft to only build one snap for arm64.
Building with a provider
When building a snap with LXD or Multipass, each build in the build plan occurs in its own environment.
In destructive mode, all builds in the build plan occur in the same location. This can cause unintended consequences, such as parts not being re-built. For more information, see this issue.
To workaround this, use --build-for or SNAPCRAFT_BUILD_FOR to build one snap at a time and run snapcraft clean --destructive-mode when changing the build-for architecture.
Build plans are not supported in core20 so building a core20 snap will only produce one snap.
Snapcraft does not automatically clean the build environment when the architecture keyword is changed. Therefore snapcraft clean should be run when changing architectures.
Launchpad supports building snaps on multiple architectures.
If architectures are not defined in the snapcraft.yaml, then Launchpad will build the snap on all architectures supported by Launchpad.
If architectures are defined in the snapcraft.yaml, then Launchpad will build the snap on all build-on architectures.
When a snap can be built on multiple architectures, Launchpad can choose which build-on platform to use. For example:
Launchpad may build the snap on an amd64 or arm64 platform. This choice is controlled by Launchpad and cannot be influenced by the user.
Could not make build plan
Could not make build plan: build-on architectures in snapcraft.yaml does not match host architecture (amd64).
This core22 error has two common causes.
The first cause is that snapcraft is not able to create a build plan because the there are no build-on architectures matching the host’s architecture. To resolve this, build the snap on an architecture listed in the snapcraft.yaml or add the host architecture as a build-on value.
The second cause is due to not enclosing a list of multiple architectures with brackets. For example: