← Back to issue list

[cross-compile] when a deb package that has a dependency to non-architecture deb package, snapcraft does not recognize that and throws a dependency error

View original Github issue

Metadata

Project
snapcraft
Number
#4268
Type
issue
State
open
Author
bugraaydogar
Labels
Status: Needs information
Created
Updated
Closed
—

Current evaluation

Core22 cross-compilation can treat an architecture-independent dependency as target-specific; cross-architecture behavior was reproduced, but current core24 behavior remains unverified.

Suggested action: keep open

Reason: The report includes a precise failing project and logs, and a maintainer reproduced related cross-architecture behavior for armhf. Although Snapcraft 8.8 improved cross-compilation and now documents `$CRAFT_ARCH_BUILD_FOR`, the latest maintainer comment explicitly requests a core24 reproduction, so there is no evidence that the original architecture-independent dependency failure was fixed.

Evaluated by: mr-cal-bot

Impact: 42 Quick Win: 14 Complexity: 48 Confidence: 84 Actionability: 63

Issue body

### Bug Description I experienced a weird error just recently while cross-building a snap based on core22. Basically, when the following dep package is added to the stage-package and `snapcraft --destructive-mode --target-arch=arm64 --enable-experimental-target-arch` is used, it will end up with the following error `Package 'gpsd-clients:arm64' has unmet dependencies: python3-serial`. ``` stage-packages: - gpsd-clients:arm64 ``` However, when I dig further, I realized that it is mainly because the python3-serial package is not architecture specific. If you try to stage-package a different deb package that is architecture specific. There is no error on this. Finally, according to my test results, if you do not specify any architecture, by default amd64 is used and snapcraft makes an exception for amd64 and does not complain about the unmet dependencies. ### To Reproduce 1- Build the following snapcraft.yaml file with `snapcraft --destructive-mode --target-arch=arm64 --enable-experimental-target-arch`. You will end up with `Package 'gpsd-clients:arm64' has unmet dependencies: python3-serial` ``` name: my-snap # 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: snap for running gpsd multiplexer # 79 char long summary description: | A snap for running GPSD, such that gps data from gpsd supported devices can be multiplexed and served over internal netwok of an ubuntu core machine. 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: [arm64] parts: gpsd: plugin: nil stage-packages: - gpsd-clients:arm64 ``` Then, build the following snapcraft.yaml file which is using a package that has architecture specific dependencies. ``` name: my-snap # 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: snap for running gpsd multiplexer # 79 char long summary description: | A snap for running GPSD, such that gps data from gpsd supported devices can be multiplexed and served over internal netwok of an ubuntu core machine. 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: [arm64] parts: gpsd: plugin: nil stage-packages: - gpsd-tools:arm64 ``` You will realize that, it builds without any issues. ### Environment Ubuntu 22.04 LTS. ### snapcraft.yaml ```shell Already provided. ``` ### Relevant log output ```shell ubuntu@snapcraft-jammy:~/host/work/geoint/issue$ snapcraft pull --destructive-mode --target-arch=arm64 --enable-experimental-target-arch --verbose Starting Snapcraft 7.4.3 Logging execution to '/home/ubuntu/.local/state/snapcraft/log/snapcraft-20230711-131542.525797.log' Running on amd64 for arm64 Initializing parts lifecycle Executing parts lifecycle... Executing parts lifecycle: pull gpsd Executing action Package 'gpsd-clients:arm64' has unmet dependencies: python3-serial. Full execution log: '/home/ubuntu/.local/state/snapcraft/log/snapcraft-20230711-131542.525797.log' ``` ``` ### Additional context _No response_

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 42
Quick Win: 14
Complexity: 48
Confidence: 84
Actionability: 63
keep open Core22 cross-compilation can treat an architecture-independent dependency as target-specific; cross-architecture behavior was reproduced, but current core24 behavior remains unverified.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 5
Complexity: 60
Confidence: 65
Actionability: 40
keep open Cross-compiling snap with architecture-specific deb packages fails when dependencies are architecture-independent (e.g. python3-serial). Issue labeled Needs information; maintainer asked reporter to test with core24/snapcraft 8.8+ but no response in 235 days.
qwen/qwen3.8-27b
Impact: 50
Quick Win: 15
Staleness: 55
Complexity: 70
Confidence: 60
Support Request: 20
keep open Cross-compiling a core22 snap with an arch-pinned stage package (gpsd-clients:arm64) fails with 'unmet dependencies: python3-serial' because non-arch-specific deps aren't resolved for the target arch. Maintainer offered a workaround and asked if it reproduces on core24; no reply yet.
qwen/qwen3.6-35b-a3b
Staleness: 85
Complexity: 40
Confidence: 75
Support Request: 30
close stale Cross-compilation dependency resolution fails for non-arch-specific packages in Snapcraft. Issue is old, has a workaround, and may be resolved in newer versions.
qwen3.6-35b-a3b-mtp-q6
Staleness: 75
Complexity: 70
Confidence: 85
Support Request: 20
keep open Cross-compiling snaps with architecture-specific packages fails due to unmet dependencies on non-arch packages. Labeled needs information; awaiting author's test results on core24/Snapcraft 8+.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#4542 (confidence 91%)

    Covers cross-compilation fetching stage packages for the host architecture instead of the target architecture.

  • Related To: canonical/snapcraft#5335 (confidence 89%)

    Addresses target-architecture stage-package selection and documents explicit `$CRAFT_ARCH_BUILD_FOR` package naming.

Related issues

Issue Project State Summary Similarity
#1881515 Snapcraft pulling wrong arch of debs when building foreign snaps snapcraft (launchpad) closed Reported --target-arch pulling wrong debs for foreign arch builds. Maintainers noted the feature was broken and disabled for core20. Marked resolved as cross-builds have been significantly improved in recent Snapcraft versions.
73%