Snapcraft 7.1.0 fails to find stage package when cross-compiling
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Snapcraft |
Fix Released
|
Undecided
|
Callahan Kovacs |
Bug Description
I tried the architectures support to cross-compile a snap for arm64 and armhf. So I added the following lines to my snapcraft.yaml:
```yaml
architectures:
- build-on: amd64
build-for: amd64
- build-on: [amd64, arm64]
build-for: arm64
- build-on: [amd64, armhf]
build-for: armhf
```
After running `snapcraft` on my amd64 machine, the amd64 snap is built correctly, but the arm64 and armhf builds fail with the error **Stage package not found in part 'theengs-gateway': bluez.**
Previously (with Snapcraft 7.0) I built the arm64 snap on a jammy LXC container on an arm64 machine, and the armhf snap on an a jammy LXC container on an armhf machine, and this just worked: the stage package bluez was found and the resulting snaps installed and ran fine locally. Building the arm64 snap on arm64 with Snapcraft 7.1 also works. So it seems something is going wrong with stage packages when cross-compiling.
Here's the project:
https:/
Here's the pull request where I try to use the architectures support:
https:/
Relevant part of the logs:
```
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:42.596 Requested stage-packages: ['bluez']
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.491 Marking bluez (and its dependencies) to be fetched
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.492 Stage package not found in part 'theengs-gateway': bluez.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 Traceback (most recent call last):
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 fetched_packages = packages.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 return method(*args, **kwargs)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 apt_cache.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 raise errors.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 craft_parts.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 During handling of the above exception, another exception occurred:
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 Traceback (most recent call last):
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 aex.execute(action, stdout=stream, stderr=stream)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 self._executor.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 self._run_
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 handler.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 state = handler(step_info, stdout=stdout, stderr=stderr)
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.496 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 fetched_packages = self._fetch_
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 File "/snap/
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 raise errors.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 craft_parts.
2022-07-27 20:05:43.822 :: 2022-07-27 20:05:43.497 Full execution log: '/tmp/snapcraft
2022-07-27 20:05:45.095 Failed to execute pack in instance.
2022-07-27 20:05:45.099 Traceback (most recent call last):
2022-07-27 20:05:45.099 File "/snap/
2022-07-27 20:05:45.099 instance.
2022-07-27 20:05:45.099 File "/snap/
2022-07-27 20:05:45.099 return self.lxc.exec(
2022-07-27 20:05:45.099 File "/snap/
2022-07-27 20:05:45.099 return runner(final_cmd, **kwargs) # pylint: disable=
2022-07-27 20:05:45.099 File "/snap/
2022-07-27 20:05:45.099 raise CalledProcessEr
2022-07-27 20:05:45.099 subprocess.
```
I have attached the full logs.
tags: | added: craft-1216 |
Changed in snapcraft: | |
status: | Confirmed → In Progress |
Changed in snapcraft: | |
status: | In Progress → Fix Released |
I’m seeing the same behavior:
- When building on amd64 with core20, snapcraft will download bluez from the amd64 repository.
- When building on amd64 with core22, snapcraft attempts to download bluez from the arm64 repository, then fails because the arm64 repository was not added.
I'll follow up @sergiusens to see if core22 should follow core20's behavior.
Minimal reproducers:
core20:
```
name: hello-world
version: "1.0"
summary: Test staging packages during cross-compilation.
description: test
grade: stable
confinement: strict
base: core20
architectures:
- build-on: amd64
run-on: arm64
parts:
hello-world:
plugin: dump
source: src
stage-packages:
- bluez
```
core22:
```
name: hello-world
version: "1.0"
summary: Test staging packages during cross-compilation.
description: test
grade: stable
confinement: strict
base: core22
architectures:
- build-on: amd64
build-for: arm64
parts:
hello-world:
plugin: nil
source: .
stage-packages:
- bluez
```