← Back to issue list

$CRAFT_ARCH_TRIPLET_BUILD_FOR doesn't work on core22

View original Github issue

Metadata

Project
snapcraft
Number
#4486
Type
issue
State
closed
Author
merlijn-sebrechts
Labels
Status: Triaged Type: Bug
Created
Updated
Closed

Current evaluation

Fixed in Snapcraft 8: core22 app environment blocks now expand CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET.

Resolution: closed resolved

Reason: Maintainer mr-cal confirmed the fix with a core22 reproducer showing both variables expanded to x86_64-linux-gnu, then the issue was closed. No specific resolving PR or commit was linked.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description From my understanding, snapcraft is supposed to replace `$CRAFT_ARCH_TRIPLET_BUILD_FOR` even if it's part of an `environment` block. That was how `${SNAPCRAFT_ARCH_TRIPLET}` worked. However, it doesn't seem to do that anymore. #### Works ```yaml apps: jenkins: environment: LD_LIBRARY_PATH: "$SNAP/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}" ``` #### Doesn't work ```yaml apps: jenkins: environment: LD_LIBRARY_PATH: "$SNAP/usr/lib/${CRAFT_ARCH_TRIPLET}" ``` ```yaml apps: jenkins: environment: LD_LIBRARY_PATH: "$SNAP/usr/lib/${CRAFT_ARCH_TRIPLET_BUILD_FOR}" ``` ### To Reproduce 1. Build jenkins repo at this tag: https://github.com/snapcrafters/jenkins/commit/bb420b4eb5db00f5532cb3168eeef73da66271e1 1. Install the resulting snap 1. Run `snap run --shell jenkins.jenkins` 1. Run `env | grep LD` Observe this weirdness. ### Environment Both local snapcraft and remote-build. ### snapcraft.yaml ```shell name: jenkins title: Jenkins summary: Jenkins automation server - Build great things at any scale description: | Jenkins is the leading open-source automation server. Built with Java, it provides over 1000 plugins to support automating virtually anything, so that humans can actually spend their time doing things machines cannot. **Authors** This snap is maintained by the Snapcrafters community, and is not necessarily endorsed or officially maintained by the upstream developers. website: https://www.jenkins.io/ contact: https://github.com//snapcrafters/jenkins/issues issues: https://github.com//snapcrafters/jenkins/issues source-code: https://github.com//snapcrafters/jenkins license: MIT adopt-info: jenkins icon: snap/local/jenkins.png version: "2.435" base: core22 confinement: classic grade: stable architectures: - build-on: amd64 - build-on: arm64 - build-on: armhf apps: jenkins: environment: XDG_DATA_HOME: "$SNAP/usr/share" FONTCONFIG_PATH: "$SNAP/etc/fonts" JAVA_HOME: "$SNAP/usr/lib/jvm/java-17-openjdk" LD_LIBRARY_PATH: "$SNAP/usr/lib/$CRAFT_ARCH_TRIPLET_BUILD_FOR" command: launch daemon: simple config: command: jenkins-config parts: jenkins: plugin: nil source: https://github.com/jenkinsci/jenkins.git source-tag: jenkins-$SNAPCRAFT_PROJECT_VERSION stage-packages: - fonts-dejavu-core - libfontconfig1 - openjdk-17-jre-headless - ca-certificates-java build-packages: - curl - libnss3 - ca-certificates-java override-build: | curl -sLO http://mirrors.jenkins.io/war/latest/jenkins.war mv $CRAFT_PART_INSTALL/usr/lib/jvm/java-17-openjdk-* $CRAFT_PART_INSTALL/usr/lib/jvm/java-17-openjdk rm $CRAFT_PART_INSTALL/usr/lib/jvm/java-17-openjdk/lib/security/cacerts cp /etc/ssl/certs/java/cacerts $CRAFT_PART_INSTALL/usr/lib/jvm/java-17-openjdk/lib/security/cacerts cp /etc/ssl/certs/java/cacerts $CRAFT_PART_INSTALL/etc/ssl/certs/java/cacerts mv jenkins.war $CRAFT_PART_INSTALL prime: - -usr/lib/jvm/java-17-openjdk-*/lib/security/blacklisted.certs - -usr/lib/jvm/java-11-openjdk-*/lib/security/blacklisted.certs config: plugin: dump source: snap/local prime: - jenkins-config - launch cleanup: after: - jenkins plugin: nil build-snaps: - core22 override-prime: | set -eux for snap in "core22"; do # List all content-snaps and base snaps you're using here cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$CRAFT_PRIME/{}" \; done ``` ### Relevant log output ```shell / ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in Snapcraft 8: core22 app environment blocks now expand CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET.
stealth/space-bunny-alpha — closed resolved Resolved in Snapcraft 8, which correctly expands CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET in core22 app environment blocks.
stealth/space-bunny-alpha — closed resolved Environment expansion now resolves both architecture variables; a maintainer confirmed the fix in Snapcraft 8 and demonstrated the corrected LD_LIBRARY_PATH output.
qwen/qwen3.6-35b-a3b — — Resolved. The $CRAFT_ARCH_TRIPLET_BUILD_FOR substitution failure in core22 environment blocks was fixed in snapcraft 8. A maintainer confirmed the fix with a working test case demonstrating correct variable replacement.
qwen/qwen3.6-35b-a3b — — Bug reporting that CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET were not replaced in environment blocks on core22 was resolved. Maintainers confirmed the fix in snapcraft 8, with variable substitution now functioning correctly.
qwen/qwen3.6-35b-a3b — — Fixed in snapcraft 8. The $CRAFT_ARCH_TRIPLET_BUILD_FOR and $CRAFT_ARCH_TRIPLET variables are now correctly substituted in core22 environment blocks, resolving the reported bug.
qwen3.6-35b-a3b-mtp-q6 — — Fixed in snapcraft 8. CRAFT_ARCH_TRIPLET_BUILD_FOR and CRAFT_ARCH_TRIPLET now correctly expand in environment blocks on core22, resolving the reported substitution bug.

Update history

No update history recorded yet.

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.
82%
#1997752 base core20: wrong arch triplet snapcraft (launchpad) closed Wrong SNAPCRAFT_ARCH_TRIPLET for core20 build-on/run-on builds fixed by adding SNAPCRAFT_ARCH_BUILD_ON/BUILD_FOR and *_TRIPLET_BUILD_FOR envvars (PR #4313, commit 93a9d8170); follow-up #4332 (48bd0632f) errors on unevaluable multi-arch cases.
76%
#300 Remote-build: use craft-application for core22 craft-application closed Core22 remote builds moved to craft-application in merged Snapcraft PR #4724 (commit 9905f2831), removing the legacy core22 build path.
73%
#4677 snapcraft 7.x fails to replace new variables snapcraft closed 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.
73%
#4785 bug: snapcraft uses '1' for CRAFT_PARALLEL_BUILD_COUNT on multi-core machine snapcraft closed Core24 builds now receive the CPU-based CRAFT_PARALLEL_BUILD_COUNT; the fix shipped in Snapcraft 8.4.4 on 2024-10-24.
72%
#1999580 core22: wrong arch in snap.yaml when building for all archs snapcraft (launchpad) closed Fixed in merged canonical/snapcraft#4150 (commit 77d3454d): core22 snap.yaml now records build-for (all) instead of the build-on architecture.
71%
#2009520 core18/20: inconsistent architecture parsing snapcraft (launchpad) closed Superseded by snapcore/snapcraft#4340 and #4341. Core22+ overlapping build-on handling merged in #3821 (4876b53); core20 support was declined.
70%
#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".
70%
#3414 project loader: export SNAPCRAFT_TARGET_ARCH in build environment snapcraft merged Merged PR #3414 (commit ff2cd96bb) added SNAPCRAFT_TARGET_ARCH to the global build environment in set_global_environment() for core22, alongside SNAPCRAFT_ARCH_TRIPLET.
70%