← Back to issue list

snapcraft 7.x fails to replace new variables

View original Github issue

Metadata

Project
snapcraft
Number
#4677
Type
issue
State
closed
Author
dilyn-corner
Labels
—
Created
Updated
Closed

Current evaluation

Closed as unsupported/works-as-designed: CRAFT_ARCH_TRIPLET_BUILD_FOR needs craft-parts 1.24.0 but Snapcraft 7.5.x pins 1.19.7. Maintainers (tigarmo, mr-cal) said no backport is planned; use CRAFT_ARCH_TRIPLET instead. The variable works from Snapcraft 8.

Resolution: closed not a bug

Reason: Maintainer tigarmo identified the cause: the build-on/build-for arch variables were added in craft-parts 9f8e969e (1.24.0), which Snapcraft 7.5.x does not use, and mr-cal later confirmed the newer env vars will not be backported, so CRAFT_ARCH_TRIPLET is the supported workaround. Support for the variable arrives with the craft-parts upgrade in Snapcraft 8, as seen in snapcraft 93a9d8170 (#4313) and issue #4486.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description Snapcraft will fail to replace the new variable syntax and will only replace the old variable syntax. ### To Reproduce Install snapcraft 7.x (only tested 7.5.4+), use the provided snapcraft.yaml. Compare the error message just in case you remove the `{` `}` around the variable. ### Environment Ubuntu 23.04, building with --use-lxd ### snapcraft.yaml ```shell name: my-snap-name # you probably want to 'snapcraft register <name>' base: core22 # the base snap is the execution environment for this snap version: '0.1' # just for humans, typically '1.2+git' or '1.3.2' summary: Single-line elevator pitch for your amazing snap # 79 char long summary description: | This is my-snap's description. You have a paragraph or two to tell the most important story about your snap. Keep it under 100 words though, we live in tweetspace and your description wants to look good in the snap store. grade: devel # must be 'stable' to release into candidate/stable channels confinement: devmode # use 'strict' once you have the right plugs and slots architectures: - build-on: amd64 build-for: riscv64 parts: my-part: # See 'snapcraft plugins' plugin: nil build-packages: - gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR} ``` ### Relevant log output ```shell 2024-03-18 20:52:34.621 :: 2024-03-18 20:52:28.857 part build packages: ['gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR}'] 2024-03-18 20:52:34.621 :: 2024-03-18 20:52:28.857 Requested build-packages: ['gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR}'] 2024-03-18 20:52:34.621 :: 2024-03-18 20:52:30.183 Marking gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR} (and its dependencies) to be fetched 2024-03-18 20:52:34.621 :: 2024-03-18 20:52:34.160 Cannot find package listed in 'build-packages': gcc-${CRAFT_ARCH_TRIPLET_BUILD_FOR} ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed not a bug Closed as unsupported/works-as-designed: CRAFT_ARCH_TRIPLET_BUILD_FOR needs craft-parts 1.24.0 but Snapcraft 7.5.x pins 1.19.7. Maintainers (tigarmo, mr-cal) said no backport is planned; use CRAFT_ARCH_TRIPLET instead. The variable works from Snapcraft 8.
stealth/space-bunny-alpha — closed not a bug Closed as a Snapcraft 7.x compatibility issue: `CRAFT_ARCH_TRIPLET_BUILD_FOR` requires craft-parts 1.24.0+, while 7.5.x used 1.19.7; no backport was planned.
stealth/space-bunny-alpha — closed not a bug Closed as unsupported: CRAFT_ARCH_TRIPLET_BUILD_FOR needs craft-parts 1.24.0 (commit 9f8e969, #532) but Snapcraft 7.5.x pins 1.19.7, so the var is never set; maintainers closed with CRAFT_ARCH_TRIPLET as the workaround.
stealth/space-bunny-alpha — closed not a bug Closed as unsupported: CRAFT_ARCH_TRIPLET_BUILD_FOR requires craft-parts 1.24.0, but Snapcraft 7.5.x uses 1.19.7; maintainers recommend CRAFT_ARCH_TRIPLET instead.
stealth/space-bunny-alpha — closed not a bug Closed without a Snapcraft 7.x fix: CRAFT_ARCH_TRIPLET_BUILD_FOR requires craft-parts 1.24.0, but 7.5.x uses 1.19.7; maintainers advised CRAFT_ARCH_TRIPLET and declined a backport.
qwen/qwen3.6-35b-a3b — — Rejected. Snapcraft 7.x uses an older craft-parts version that does not support newer environment variables. The team will not backport them. Users must use legacy variable names like CRAFT_ARCH_TRIPLET instead.
qwen/qwen3.6-35b-a3b — — Closed as won't fix. The CRAFT_ARCH_TRIPLET_BUILD_FOR variable requires a newer craft-parts version not backported to Snapcraft 7.x. The team declined to update the dependency. Users should fallback to the legacy CRAFT_ARCH_TRIPLET variable.
qwen/qwen3.6-35b-a3b — — Closed as won't fix. Snapcraft 7.x lacks support for newer craft-parts environment variables due to an outdated dependency. Users should use legacy variable names like CRAFT_ARCH_TRIPLET instead of expecting a backport.
qwen3.6-35b-a3b-mtp-q6 — — Closed without a fix. Snapcraft 7.x cannot expand new CRAFT variables due to an outdated craft-parts dependency. Backporting is not planned; users must use legacy variable syntax instead.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-parts#532 (confidence 85%)

    craft-parts commit 9f8e969e introduced CRAFT_ARCH_TRIPLET_BUILD_FOR; Snapcraft only gained it after upgrading craft-parts (commit 93a9d8170 / PR #4313) in Snapcraft 8, not in 7.x.

  • Duplicate Of: snapcraft#4486 (confidence 80%)

    Same unsupported-variable problem on core22; closed as resolved in Snapcraft 8.

  • Related To: canonical/craft-parts#541 (confidence 55%)

    Related premature-expansion bug for CRAFT_ARCH_TRIPLET_BUILD_FOR in craft-parts, fixed by #554 (438fa857).

Related issues

Issue Project State Summary Similarity
#1973376 SNAPCRAFT_ARCH_TRIPLET not usable with core22 base snapcraft (launchpad) closed Closed without a code fix: core22 requires CRAFT_ARCH_TRIPLET instead of SNAPCRAFT_ARCH_TRIPLET; the reporter confirmed Snapcraft 7.0.2 builds successfully with the replacement.
77%
#4486 $CRAFT_ARCH_TRIPLET_BUILD_FOR doesn't work on core22 snapcraft closed Fixed in Snapcraft 8: core22 app environment blocks now expand CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET.
73%
#1980536 snapcraft unusable on systems not using apt snapcraft (launchpad) closed Snapcraft 7.1.1 fixed startup failures on non-APT systems; the 7.0.8 regression was linked to snapcore/snapcraft#3804.
72%