← 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

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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Fixed in snapcraft 8. The $CRAFT_ARCH_TRIPLET_BUILD_FOR and $CRAFT_ARCH_TRIPLET variables now correctly expand within environment blocks on core22, resolving the reported 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 resolution. The report details a core22 build failure where snapcraft rejects SNAPCRAFT_ARCH_TRIPLET in layout mount points during packing. Core20 remains compatible.
78%
#1997752 base core20: wrong arch triplet snapcraft (launchpad) closed Closed without a fix or resolution, likely abandoned due to inactivity. The report indicated Snapcraft incorrectly sets SNAPCRAFT_ARCH_TRIPLET when building on a mismatched host architecture. No comments or patches were submitted.
76%
#4770 Wrong arch being used in core24 project variables snapcraft closed The CRAFT_ARCH_TRIPLET_BUILD_FOR variable incorrectly used the host architecture instead of the target when using --build-for on core24. The bug was resolved and merged via pull request #4779.
73%
#5634 Core22 unit tests in snapcraft fails with craft application 5.5.0 snapcraft closed Closed and deferred. The core22 test failure was traced to a validation change in craft-application PR #812. The issue was logged internally as SNAPCRAFT-1188 for tracking.
71%
#4677 snapcraft 7.x fails to replace new variables snapcraft closed 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.
70%
#3821 meta: architectures snapcraft merged Merged adding build-on and build-for architecture support for core22 snaps. Introduced the SNAPCRAFT_BUILD_FOR environment variable to limit builds. Temporarily drafted to fix a duplicate build regression before final merge.
70%
#4332 environment: error when build-for arch variable cannot be evaluated snapcraft merged Merged. Resolves #4314 by raising an error instead of silently evaluating to None when SNAPCRAFT_ARCH_BUILD_FOR or SNAPCRAFT_ARCH_TRIPLET_BUILD_FOR cannot be determined for core20 snaps. Approved by three reviewers and passed CI.
70%