← Back to issue list

Snapcraft not verbose enough when missing architecture on plataforms

View original Github issue

Metadata

Project
snapcraft
Number
#5034
Type
issue
State
closed
Author
gabrielcocenza
Labels
Status: Triaged Type: Enhancement
Created
Updated
Closed

Current evaluation

Resolved via canonical/craft-application#437: incompatible builds now explain that no build matches and recommend checking platforms, --platform, or --build-for.

Resolution: closed resolved

Reason: A Snapcraft maintainer confirmed the issue was solved and demonstrated the new actionable error message. The credited fix is canonical/craft-application#437.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description I recently faced an issue where the snapcraft was simply not building on arm64 without an apparent reason. In the end it was because it was missing some information in the metadata (snapcraft.yaml) Also the [documentation](https://snapcraft.io/docs/reference-architectures#core24) is not clear and says: > The platform name describes a build-on/build-for pairing. If the platform name is a valid debian architecture, then build-on and build-for can be omitted (see below for details). > See [here](https://snapcraft.io/docs/reference-architectures#heading--supported-architectures) for a list of supported architectures. > The recommended platform name is build-for arch. The `here` link is broken and from my interpretation, the build-on and the build-for cannot be omitted (at least if there is something already declared like amd64) IMO there are some things that needs clarification: 1. It seems that works fine if `platforms` is not declared at all, but if at least one arch is declared, than building on another arch fails 2. I think the ideal scenario would be to be able to build even with this "half declarative" way that the snapcraft yaml was, but at least having a warning message saying that once some arch is declared, the others won't work would be helpful for the users have a better clue what is going on ### To Reproduce Have a snapcraft.yaml file that has the following content (without arm64): ``` platforms: amd64: build-on: [amd64] build-for: [amd64] ``` And try to build the snap on a arm64 machine. ### Environment Ubuntu 22.04 LTS using snapcraft on latest/stable channel ### snapcraft.yaml ```yaml name: dcgm base: core24 adopt-info: dcgm-exporter summary: Snap for NVIDIA DCGM and DCGM exporter license: Apache-2.0 contact: solutions-engineering@lists.canonical.com description: | This snap includes NVIDIA DCGM and DCGM exporter to provide GPU monitoring via Prometheus metrics. platforms: amd64: build-on: [amd64] build-for: [amd64] grade: stable confinement: strict source-code: https://github.com/canonical/dcgm-snap issues: https://github.com/canonical/dcgm-snap/issues title: NVIDIA DCGM apps: dcgm-exporter: command: bin/dcgm-exporter plugs: - network-bind - opengl dcgmi: command: usr/bin/dcgmi plugs: - network-bind - opengl nv-hostengine: command: run_nv_hostengine.sh plugs: - network-bind - opengl daemon: simple restart-condition: on-abort environment: DCGM_HOME_DIR: "${SNAP_COMMON}" dcgmproftester10: command: usr/bin/dcgmproftester10 dcgmproftester11: command: usr/bin/dcgmproftester11 dcgmproftester12: command: usr/bin/dcgmproftester12 parts: wrapper: plugin: dump build-packages: - wget - dpkg source: snap/local override-pull: | craftctl default ./configure_sources.sh override-build: | craftctl default chmod +x run_nv_hostengine.sh dcgm-exporter: after: - wrapper plugin: go stage-packages: [datacenter-gpu-manager=1:3.3.7] build-snaps: - go source: https://github.com/NVIDIA/dcgm-exporter.git source-type: git source-tag: 3.3.7-3.5.0 # override build to set custom csv file override-build: | craftctl default mkdir -p $SNAPCRAFT_PART_INSTALL/etc/dcgm-exporter cp etc/default-counters.csv etc/dcp-metrics-included.csv $SNAPCRAFT_PART_INSTALL/etc/dcgm-exporter/ # override prime to set version override-prime: | craftctl default # Locate dcgm .deb file DEB_FILE=$(ls $HOME/parts/dcgm-exporter/stage_packages/datacenter-gpu-manager_*.deb) # Extract the version from the .deb file DCGM_VERSION=$(dpkg-deb -f "$DEB_FILE" Version) # Set the Snap version to the same as dcgm deb file craftctl set version="${DCGM_VERSION#1:}" layout: /etc/dcgm-exporter: symlink: $SNAP/etc/dcgm-exporter ``` ### Relevant log output ```shell This is the [logs](https://github.com/canonical/dcgm-snap/actions/runs/10836527295/job/30070483459) that will show up: Installing Snapcraft plus dependencies Ensuring ubuntu is in the lxd group... /usr/bin/sudo groupadd --force --system lxd /usr/bin/sudo usermod --append --groups lxd ubuntu Installing LXD... /usr/bin/sudo snap install lxd lxd (5.21/stable) 5.21.2-2f4ba6b from Canonical** installed Initialising LXD... /usr/bin/sudo lxd init --auto Installed docker related packages might interfere with LXD networking: /usr/bin/sudo iptables -P FORWARD ACCEPT Installing Snapcraft... /usr/bin/sudo snap install --channel stable --classic snapcraft snapcraft [8](https://github.com/canonical/dcgm-snap/actions/runs/10836527295/job/30070483459#step:4:9).3.3 from Canonical** installed /usr/bin/sudo -u ubuntu -E snapcraft Error: No snap files produced by build ``` I don't have now the debug logs right now, but I remember that it was validating the syntax and exit without explanation ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Resolved via canonical/craft-application#437: incompatible builds now explain that no build matches and recommend checking platforms, --platform, or --build-for.
stealth/space-bunny-alpha — closed resolved Resolved by merged craft-application PR #437, which now reports an empty build plan and recommends checking the project's platforms declaration.
stealth/space-bunny-alpha — closed resolved Resolved by merged canonical/craft-application#437: empty build plans now recommend checking platforms and platform-selection flags.
stealth/space-bunny-alpha — closed resolved Enhanced missing-platform diagnostics via merged craft-application PR #437; Snapcraft now recommends checking platforms, --platform and --build-for.
stealth/space-bunny-alpha — closed superseded Verbosity request resolved: craft-application PR #437 (commit 5e7560e4) added EmptyBuildPlanError, which now reports "No build matches the current execution environment" and recommends checking the platforms declaration, replacing the bare "No snap files produced by build".
stealth/space-bunny-alpha — closed resolved Resolved by merged craft-application PR #437, which makes empty build plans fail with guidance to check platforms, as confirmed by the maintainer.
qwen/qwen3.6-35b-a3b — — Resolved by canonical/craft-application#437. Snapcraft now outputs a clear error message recommending users check the platforms declaration or build parameters when the execution environment lacks a matching architecture.
qwen/qwen3.6-35b-a3b — — Resolved by craft-application#437. Snapcraft now displays a clear error recommending users verify the platforms declaration and build parameters when the execution environment lacks a matching architecture.
qwen/qwen3.6-35b-a3b — — Fixed by canonical/craft-application#437. Snapcraft now outputs a clear error recommending users verify the platforms declaration when the build environment lacks a matching architecture.
qwen3.6-35b-a3b-mtp-q6 — — Resolved by canonical/craft-application#437. Snapcraft now outputs a clear error recommending users adjust the platforms declaration or build parameters when the current architecture is not declared in the project file.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-application#437 (confidence 99%)

    Introduced the improved resolution guidance for builds excluded by the project's platforms declaration or build-selection parameters.

Related issues

Issue Project State Summary Similarity
#4214 snapcraft 7.4.3 doesn't adequately complain about non-existent architectures snapcraft closed Fixed in Snapcraft 8: invalid build-on architectures now produce a clear validation error listing all supported architectures.
76%
#4993 Use craft-platforms utilities snapcraft closed Fixed by merged PR #5205 (commit 3aacad74b, "refactor: use craft-platforms utilities"), which replaced snapcraft's own get_host_architecture/supported-architecture helpers with craft-platforms equivalents (CRAFT-3278).
72%
#4780 remote build: fails with some architecture definitions snapcraft closed Remote-build architecture handling was fixed by merged PR canonical/snapcraft#4793 (commit 53ec55cef), with companion support in canonical/craft-application#343.
70%