← Back to issue list

build-on is/isn't mandatory/optional?

View original Github issue

Metadata

Project
snapcraft
Number
#5531
Type
issue
State
open
Author
waveform80
Labels
Status: Triaged Type: Documentation
Created
Updated
Closed

Current evaluation

Snapcraft 8.9.2 rejects empty-dict platform entries (e.g. amd64: {}) requiring build-on, contradicting docs. Maintainers confirmed behavior is intentional after craft-platforms refactor; decision made to update docs rather than restore empty-dict support.

Suggested action: keep open

Reason: Maintainers explicitly decided on 2025-06-05 to 'leave this behavior as-is and update the documentation' after discussing with @lengau and @cmatsuoka. The docs still say build-on can be omitted for valid Debian arch names, but don't clarify that empty dicts are invalid — only null/empty values work. This is a pending doc fix that should remain open until the documentation is updated to clarify the distinction between omitted/null and empty-dict platform values.

Impact: 40 Quick Win: 28.0 Staleness: 55 Complexity: 30 Confidence: 85 Support Request: 35

Issue body

### Bug Description Snapcraft is complaining that the `build-on` key under `platforms` must be specified. This is strange as I've successfully built this snap with (presumably) older versions of snapcraft successfully, and the [snapcraft documentation](https://documentation.ubuntu.com/snapcraft/stable/reference/architectures/#platform) still clearly states: > If the platform name is a valid debian architecture, then build-on and build-for can be omitted I'm guessing either the docs are wrong, or snapcraft's behaviour is ... ### To Reproduce Attempt to run `snapcraft pack` locally on the [rpi-imager snapcraft.yaml](https://github.com/waveform80/imager-snap/blob/e657c2e81447121986dbdf346752e3a4fb5e184c/snap/snapcraft.yaml#L32) ### Environment Snapcraft 8.9.2 running under Ubuntu 24.04.2 on an arm64 system, with LXD ### snapcraft.yaml ```yaml name: rpi-imager base: core24 adopt-info: imagewriter summary: Raspberry Pi Imager website: https://www.raspberrypi.com/software/ source-code: https://github.com/r41k0u/rpi-imager issues: https://github.com/waveform80/imager-snap icon: images/rpi-imager.png license: Apache-2.0 description: | Raspberry Pi Imager is an easy to use application for installing Raspberry Pi OS, or other operating systems, to an SD card ready to use with your Raspberry Pi. Usage is as simple as: 1. Pick the Raspberry Pi board you want to use. 2. Pick the operating system you want to write. 3. Pick the storage you want to write it to (SD card, hard drive, SSD, etc.) 4. Click "NEXT", confirm you wish to overwrite your storage and wait! The application also verifies that the operating system has been written correctly after writing has finished. With certain operating system images, the imager also supports customizing the first boot configuration (you will be prompted for more information after selecting "NEXT" in this case). compression: lzo grade: stable confinement: strict platforms: amd64: {} arm64: {} armhf: {} # This isn't going to work until the gnome content snap supports it #riscv64: {} # Can't build ppc64el anymore as gnome content snap stopped supporting it # in Core 24 #ppc64el: {} # Can't build s390x as upstream is little-endian specific #s390x: {} apps: rpi-imager: command: usr/local/bin/rpi-imager command-chain: - bin/desktop-launch desktop: usr/local/share/applications/org.raspberrypi.rpi-imager.desktop environment: DISABLE_WAYLAND: 1 extensions: [gnome] plugs: - x11 - opengl - network - desktop - desktop-legacy - home - removable-media # required to re-write first-boot configuration - mount-observe # required to report mounts on target media - network-manager # required to grab image - network-control - cifs-mount - udisks2 # required for writing to sd card - hardware-observe # required to find card with lsblk - wayland # required for theming on wayland - gsettings # required for theming on wayland parts: desktop-qt6: source: https://github.com/r41k0u/snapcraft-desktop-helpers.git source-subdir: qt plugin: make make-parameters: ["FLAVOR=qt6"] build-packages: - build-essential - qt6-base-dev - dpkg-dev stage-packages: - dmz-cursor-theme - light-themes - adwaita-icon-theme - gnome-themes-extra - shared-mime-info - libqt6gui6t64 - libgtk2.0-0t64 - libgdk-pixbuf2.0-0 - libqt6svg6 # for loading icon themes which are svg - locales-all - xdg-user-dirs - fcitx-frontend-qt6 qt6-gtk-platform: plugin: nil stage-packages: - qt6-gtk-platformtheme build-packages: - libglib2.0-bin override-prime: | craftctl default glib-compile-schemas "$CRAFT_PRIME"/usr/share/glib-2.0/schemas if [ "$CRAFT_ARCH_BUILD_FOR" == "amd64" ]; then ARCH="x86_64-linux-gnu" elif [ "$CRAFT_ARCH_BUILD_FOR" == "armhf" ]; then ARCH="arm-linux-gnueabihf" elif [ "$CRAFT_ARCH_BUILD_FOR" == "arm64" ]; then ARCH="aarch64-linux-gnu" #elif [ "$CRAFT_ARCH_BUILD_FOR" == "ppc64el" ]; then # ARCH="powerpc64le-linux-gnu" else ARCH="${CRAFT_ARCH_BUILD_FOR}-linux-gnu" fi mv usr/lib/${ARCH}/libproxy/libpxbackend-1.0.so usr/lib/${ARCH} rm -r usr/lib/${ARCH}/libproxy imagewriter: plugin: cmake cmake-parameters: - -DENABLE_CHECK_VERSION=OFF - -DQt6_ROOT= source: https://github.com/raspberrypi/rpi-imager.git source-subdir: src source-type: git override-pull: | craftctl default # Upstream no longer tag releases; manually set version and checkout craftctl set version="1.9.3" git fetch git checkout ebd2a01c66237ce4a8c4ce3a5cdae6dcc307cc0f # Strip out the embedded source if [ -d "$CRAFT_PART_SRC"/embedded ]; then rm -fr "$CRAFT_PART_SRC"/embedded fi # Patch the required Qt version patch -p1 < "$CRAFT_PROJECT_DIR"/qt-6.4.patch # Point the icon to the right place sed -i -e \ 's|^Icon=rpi-imager|Icon=/usr/local/share/icons/hicolor/128x128/apps/rpi-imager.png|' \ "$CRAFT_PART_SRC"/src/linux/org.raspberrypi.rpi-imager.desktop stage-packages: - util-linux - qml6-module-qtquick - qml6-module-qtquick-controls - qml6-module-qtquick-layouts - qml6-module-qtquick-templates - qml6-module-qtquick-window - qml6-module-qtqml-workerscript - dosfstools - fdisk - libqt6widgets6t64 build-packages: - cmake - pkg-config - devscripts - libgnutls28-dev - libdrm-dev - qt6-base-dev - qt6-base-dev-tools - qt6-declarative-dev - qt6-tools-dev-tools - qt6-tools-dev - libqt6svg6-dev ``` ### Relevant log output ```shell Bad snapcraft.yaml content: - field 'build-on' required in 'platforms.amd64' configuration - field 'build-on' required in 'platforms.arm64' configuration - field 'build-on' required in 'platforms.armhf' configuration ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 40
Quick Win: 28.0
Staleness: 55
Complexity: 30
Confidence: 85
Support Request: 35
keep open Snapcraft 8.9.2 rejects empty-dict platform entries (e.g. amd64: {}) requiring build-on, contradicting docs. Maintainers confirmed behavior is intentional after craft-platforms refactor; decision made to update docs rather than restore empty-dict support.
qwen/qwen3.8-27b
Impact: 40
Quick Win: 30.0
Staleness: 55
Complexity: 25
Confidence: 85
Support Request: 30
keep open Snapcraft 8.9.2 rejects empty platform dicts (build-on required) despite docs saying it can be omitted. Maintainers decided to keep behavior and update docs; doc fix pending.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 5
Confidence: 90
Support Request: 70
keep open Snapcraft now requires explicit build-on values instead of empty dictionaries under platforms. Maintainers decided to keep the new behavior and update documentation instead of reverting.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 15
Confidence: 90
Support Request: 10
close not a bug Snapcraft 8.9.2 requires explicit build-on values, breaking compatibility with older versions that accepted empty platform dictionaries. Maintainers have decided to update documentation rather than revert the parsing change.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 10
Confidence: 90
Support Request: 10
close not a bug Snapcraft now requires platform keys to be null or omitted instead of empty dictionaries. Triaged as a documentation issue, the team will update the docs to clarify the parsing change rather than reverting the behavior.

Update history

No update history recorded yet.

Related work

  • Caused By: snapcraft/snapcraft#5111 (confidence 75%)

    PR 'feat: use craft-platforms for build plans' introduced the craft-platforms dependency that changed platform parsing behavior, causing empty dicts to be rejected

  • Related To: snapcraft/snapcraft#5205 (confidence 60%)

    Refactor to use craft-platforms utilities further consolidated platform handling

Related issues

No related issues found above the similarity threshold.