fix(remotebuild): don't fail when cross-compiling
Metadata
Current evaluation
Merged fix resolving remote build cross-compilation failures. Snapcraft now passes build-on architectures to Launchpad instead of build-for, enabling correct cross-compilation and addressing issue #4996. Approved by reviewers and passed CI.
Suggested action: —
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint`?
- [x] Have you successfully run `make test`?
---
This PR updates Snapcraft to pass `build-on` architectures to Launchpad rather than the `build-for` architectures. It updates the spread tests to exercise this.
Benefits:
* Previously, a snap with `build-for: [all]` would build on `amd64`. Now it builds on one of the `build-on` architectures in the `snapcraft.yaml`.
* Cross-compiling works with remote builds.
This is possible due to the following constraints:
* Snapcraft only allows one artifact to be remotely built on each `build-on` architecture.
* Launchpad accepts a list of architectures where to build an artifact and choose one architecture from that list.
Spread tests: https://github.com/canonical/snapcraft/actions/runs/13401419675
Fixes #4996
(CRAFT-3280)
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged fix resolving remote build cross-compilation failures. Snapcraft now passes build-on architectures to Launchpad instead of build-for, enabling correct cross-compilation and addressing issue #4996. Approved by reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Resolves #4996 by updating Snapcraft to pass build-on architectures to Launchpad instead of build-for, fixing remote build cross-compilation failures. Includes updated spread tests. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged fix for remote build cross-compilation failures. Snapcraft now passes build-on architectures to Launchpad instead of build-for, enabling cross-compilation and resolving issue #4996. Tests updated. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4996 remote build: fix cross-compiling errors and `build-for: all` errors | snapcraft | closed | Fixed by passing build-on architectures to Launchpad instead of build-for, enabling cross-compiling and correct architecture selection for build-for: all. | |
| #2500 cli: add remote build | snapcraft | merged | Merged. Adds remote build capability to Launchpad, dispatching source trees for remote compilation and retrieving resulting snap packages or logs. Approved by reviewers, passed CI, and integrated despite a minor test coverage decrease. | |
| #4783 remote build: fail if launchpad fails to create artifacts | snapcraft | closed | Fixed via #4826. Snapcraft remote-build now exits with an error when Launchpad fails to produce artifacts due to architecture mismatches, replacing the previous silent success with explicit failure reporting and validation. | |
| #4793 fix(remote-build): don't fail with certain archs | snapcraft | merged | Merged a fix for remote-build architecture failures. The changes were retargeted to the hotfix branch per reviewer request before approval and merge. | |
| #5005 fix(remotebuild): error early for multiple artifacts per build-on | snapcraft | merged | Merged. Adds early validation to prevent Launchpad build failures when multiple artifacts share the same build-on architecture. Replaces cryptic errors with a clear message, resolving issue #4995. Approved and passed CI. | |
| #299 fix(remote-build): minor edge cases found with snapcraft | craft-application | merged | Fixed minor snapcraft edge cases in remote builds. Merged following approval by two reviewers and passing CI checks. The update modifies three files, adding 43 lines and removing 13. | |
| #2173 fix(snap): fix build on 32-bit platforms | charmcraft | merged | Merged a one-line fix resolving snap build failures on 32-bit armhf platforms. Approved by three reviewers and validated via a successful Launchpad remote build. | |
| #5351 fix(remote): error early for invalid platform usage | snapcraft | merged | Merged a fix that raises an early error when --build-for conflicts with shorthand platform entries, preventing unfriendly Launchpad failures. The change passed CI checks and received approvals, resolving issue #5270. | |
| #4495 remote build: odd errors for certain `architectures:` setups | snapcraft | closed | Remote build architecture validation errors and misleading logs were fixed via remote-builder improvements and PR 4994. Conflicting build-for flags now yield a user-friendly error, and Launchpad reporting was corrected. Closed. | |
| #1064 fix: skip injecting snaps from host when cross-building | craft-application | closed | Closed after passing CI checks, implementing a fix to skip injecting host snaps during cross-building. Addresses CRAFT-5118. |