build(hotfix/2.7): build snap with current rust and setuptools
Metadata
Current evaluation
Merged hotfix to fix snap build failures by pinning rustc to 1.91 and bumping protobuf to 4.25.8, resolving compatibility issues with modern build toolchains.
Resolution: closed resolved
Reason: PR #2941 was merged, updating the snap build environment to use rustc 1.91 and protobuf 4.25.8 to resolve build failures against modern toolchains.
Evaluated by: mr-cal-bot
No scores available.
Issue body
## Summary
Stacked on #2940.
`snap-build` fails in the `charmcraft` part. The snap builds every dependency
from source (`PIP_NO_BINARY: ":all:"`, kept deliberately to work around
<https://github.com/canonical/charmcraft/issues/1369>), which pins the build
against whatever toolchain the build environment ships. That environment has
moved on twice, and both failures are in this one part:
1. pip also builds the Rust build backends from source, and maturin needs a
newer rustc than the snap pins:
```
error: rustc 1.85.1 is not supported by the following packages:
maturin@1.15.0 requires rustc 1.89
ERROR: Failed to build wheel for maturin
```
2. protobuf 3.20.3's `setup.py` imports `pkg_resources`, which setuptools
removed in 81 (current setuptools is 84), so that sdist cannot build at all:
```
ModuleNotFoundError: No module named 'pkg_resources'
ERROR: Failed to build 'protobuf' when getting requirements to build wheel
```
### Fixes
- Pin `cargo`/`rustc` to 1.91 instead of 1.85. 1.91.1 is in the `core22`
(jammy) archive for every architecture this snap builds for, and is the
same toolchain `hotfix/4.4` pins.
- Bump `protobuf` 3.20.3 -> 4.25.8. Both failures are the same class of
problem (ancient sdist, modern build tool), so they are fixed together.
4.25.8 is API compatible for this repo's only consumer: `macaroonbakery`
requires `protobuf >=3.20.0`, and the 4.x line of that era is a re-versioning
of the 3.20 code. Verified locally that the 4.25.8 sdist builds fully on
Python 3.10 with setuptools 84.
Two alternatives were considered and rejected:
- Keeping protobuf 3.20.3 and pinning an older setuptools for the build
environment: pip ignores constraints files for build isolation (verified:
`--constraint setuptools<81` still installed setuptools 84.0.0 into the
isolated env), so this cannot be expressed from the repo.
- Keeping protobuf 3.20.3 but allowing its wheel (`PIP_ONLY_BINARY: protobuf`):
its only arch-independent wheel is `protobuf-3.20.3-py2.py3-none-any.whl`,
i.e. the slower pure-Python implementation, to avoid a version bump.
## Test plan
CI: `snap-build` compiles `maturin` and `protobuf` and completes the
`charmcraft` part, which also unblocks `snap-tests`.
> [!WARNING]
> Generated by an automated agent, not a human.
🤖 **BEEP BOOP I'M A TOASTER**
_Model:_ `step-5-preview-free`
_Harness:_ opencode CLI
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | closed resolved | Merged hotfix to fix snap build failures by pinning rustc to 1.91 and bumping protobuf to 4.25.8, resolving compatibility issues with modern build toolchains. |
Update history
| Date | Change |
|---|---|
| merged | |
| updated | |
| updated | |
| updated | |
| created |
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2932 fix(hotfix/2.7): build snap with rustc 1.91 to satisfy maturin | charmcraft | closed | Fixed in #2932 by updating rustc to 1.91.1 to satisfy maturin 1.15.0 requirements, resolving snap-build failures. |