Raise error when using `BUILD_FOR` envvars on multi-arch and unknown builds
Metadata
Current evaluation
Fixed by PR #4332 (commit 48bd0632f), which makes Snapcraft error when BUILD_FOR architecture variables cannot be evaluated for multi-arch or unknown-architecture builds.
Resolution: closed resolved
Reason: PR #4332 was merged as commit 48bd0632f, adding the requested error for unevaluable BUILD_FOR architecture variables.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### What needs to get done
https://github.com/snapcore/snapcraft/pull/4313 added the following environment variables for core20 snaps:
- SNAPCRAFT_ARCH_BUILD_ON
- SNAPCRAFT_ARCH_TRIPLET_BUILD_ON
- SNAPCRAFT_ARCH_BUILD_FOR
- SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR
Multi-arch builds and builds with unknown architectures do not evaluate `SNAPCRAFT_ARCH_BUILD_FOR` or `SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR`.
When these envvars are used in a snapcraft.yaml, an error should be raised, explaining to the user why they cannot use these envvars.
### Why it needs to get done
This will improve the user experience for core20 snaps, where users are allowed to build for multiple architectures and unknown architectures.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #4332 (commit 48bd0632f), which makes Snapcraft error when BUILD_FOR architecture variables cannot be evaluated for multi-arch or unknown-architecture builds. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #4332 (commit 48bd0632f), which raises an error when core20 BUILD_FOR environment variables cannot be evaluated for multi-arch or unknown builds. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by PR #4332 (commit 48bd0632f), adding an error when BUILD_FOR environment variables cannot be evaluated. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and superseded by a warning approach for empty build-for values instead of raising a hard error. | |
| qwen/qwen3.6-35b-a3b | — | — | Abandoned. A maintainer recommended emitting a warning for empty build-for instead of raising an error, citing edge cases in override-build and Makefiles. | |
| qwen/qwen3.6-35b-a3b | — | — | Superseded by implementing a warning for empty build-for values instead of raising a hard error on multi-arch builds. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Resolved by emitting a warning for empty build-for values instead of raising an error, as suggested. Closed without implementing hard validation. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#4332
(confidence 100%)
Merged fix commit 48bd06322f added the error handling requested by the issue.
-
Related To:
canonical/snapcraft#4313
(confidence 100%)
Introduced the core20 BUILD_FOR environment variables covered by this issue.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4332 environment: error when build-for arch variable cannot be evaluated | snapcraft | merged | Merged PR #4332 (48bd0632f) now errors on unevaluable core20 SNAPCRAFT_ARCH_BUILD_FOR and SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR variables instead of producing "None". | |
| #4996 remote build: fix cross-compiling errors and `build-for: all` errors | snapcraft | closed | Fixed by merged PR canonical/snapcraft#5265 (commit f94da8f13), sending build-on architectures to Launchpad for correct cross-compilation and build-for: all behavior. | |
| #335 fix: use `build-for` when evaluating project variables | craft-application | merged | Merged #335 fixed BUILD_FOR project-variable evaluation by passing the build-for architecture to craft-parts; released in craft-application 2.6.3 and adopted by snapcraft#4779. |