snapcraft icon indicating copy to clipboard operation
snapcraft copied to clipboard

architectures: allow same arch in multiple build-ons in core20

Open mr-cal opened this issue 2 years ago • 3 comments

What needs to get done

core20 snaps should allow the same architecture in multiple build-ons, when a target arch is supplied with snapcraft --target-arch armhf --enable-experimental-target-arch --destructive-mode.

Caevaets:

  • all 3 cli options in snapcraft --target-arch armhf --enable-experimental-target-arch --destructive-mode must be used everytime
  • the snap will not be able to be built with snapcraft remote-build

Why it needs to get done

Currently, core20 snaps do not allow the same architecture to be present in multiple build-ons.

Consider the following snapcraft.yaml:

base: core20
architectures:
  - build-on: [amd64, arm64, armhf]
    run-on: armhf
  - build-on: [amd64, arm64]
    run-on: arm64

Running snapcraft with or without a target arch produces the following error: Issues while validating snapcraft.yaml: The 'architectures' property does not match the required schema: 'amd64' and 'arm64' are present in the 'build-on' of multiple items, which means snapcraft doesn't know which 'run-on' to use when building on those architectures

When a target arch is supplied, snapcraft has enough information to determine which build-on/run-on tuple to use.

source: https://bugs.launchpad.net/snapcraft/+bug/2009520

mr-cal avatar Aug 30 '23 15:08 mr-cal

I believe this is also an issue for core22 snaps, and extending this to supporting those bases would also be nice.

dilyn-corner avatar Sep 01 '23 15:09 dilyn-corner

I believe this is also an issue for core22 snaps, and extending this to supporting those bases would also be nice.

Can you double-check?

The same yaml should work on core22 and create 2 snaps by default. It can also take --build-for=<arch> to create one snap.

base: core22
architectures:
  - build-on: [amd64, arm64, armhf]
    build-for: armhf
  - build-on: [amd64, arm64]
    build-for: arm64

mr-cal avatar Sep 01 '23 15:09 mr-cal

Seems you're right... Perhaps I'm misremembering. I'll see if I can dig up what I was doing.

dilyn-corner avatar Sep 01 '23 15:09 dilyn-corner

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/SNAPCRAFT-1093.

This message was autogenerated

Closing this issue because of this functionality was added in core22 and newer bases and is an enhancement, not a bug, for core20. The effort required and risk of regressions and breaking legacy remotes builds is too high to pursue.

mr-cal avatar Apr 24 '25 15:04 mr-cal