How do I deal with this error: package `flate2 v1.1.2` cannot be built because it requires rustc 1.67.0 or newer, while the currently active rustc version is 1.63.0

I have the O/S supplied version of rustc (and its libraries), which is 1.63.0. I am on a Raspberry Pi5, running Raspberry Pi OS 12 (Debian 12 / aarch64). I would rather not do something like install rustc 1.67, which I suspect would have to be built from sources and installed under /usr/local (and it would likely have all sorts of dependencies). The error message includes the vaguely helpful (maybe) that I can install an lower version of the offenting package, but how do I know what version I should install and what other packages will that "break"? Is this solvable? My goal is to use genpdf. But if there is another package for writing PDF files. Or maybe something else for generating some kind of formatted printout that will work with rustc 1.63.0.

1 Like

You don't have to build it from source, and rust has relatively few external dependencies.

You'll want to use the official installation method from the rust-lang.org website, called rustup. As listed on the rustup dashboard, aarch64 linux is a tier 1 platform, so the curl | bash method will work out of the box.

3 Likes

Well, rustup has some issues:

marchhare% curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
info: downloading installer
warn: It looks like you have an existing installation of Rust at:
warn: /usr/bin
warn: It is recommended that rustup be the primary Rust installation.
warn: Otherwise you may have confusion unless you are careful with your PATH.
warn: If you are sure that you want both rustup and your already installed Rust
warn: then please reply `y' or `yes' or set RUSTUP_INIT_SKIP_PATH_CHECK to yes
warn: or pass `-y' to ignore all ignorable checks.
error: cannot install while Rust is installed

It also wants to istall it under my home directory, which is not something I would rather do. I'd rather stick with the version of rustc provided by the O/S.

You can run a command like this to downgrade to a version of flate2 from 2022, around the same time as Rust 1.63:

cargo update -p flate2 --precise 1.0.25

However, you will likely continue to have similar problems as long as you are using a Rust compiler from over three years ago. You will need to manually downgrade to old versions of some crates, and won't be able to use many recent crates at all. Newer versions of Cargo have a rust-version-aware resolver that makes this somewhat better by automatically selecting compatible crates, but we can't retroactively add that feature to Cargo 1.63.

Edit: Browsing the versions on crates.io, it looks like the highest compatible version of flate2 is v1.0.35.

2 Likes

Depending on your appetite for risk, you might find it better to upgrade to a beta version of Raspberry Pi OS 13 with Rust 1.85, which as noted comes with a Rust-version-aware resolver.

But my choice would be to uninstall the old Debian packages, set RUSTUP_HOME=/opt/rustup, and use rustup to manage the installation instead of apt.

3 Likes

If you want to get into Rust software development, you should use rustup (or install newer Rust via other means). Not doing so will greatly limit the things you can do.

  • No access to beta/nightly versions of Rust, which are required for some dev tools.
  • No use of language features less than 2 years old.
  • No use of many libraries less than 2 years old.

The only really good reason to stick to Rust 1.63.0 is if your goal is specifically to write software that will compile on Debian with little work. Debian’s packaged Rust is notoriously old.

6 Likes

The flate2 crate was updated to 1.1 when the Rust MSRV was increased to 1.67.

To force use of the latest version prior to that you can use

flate2 = "~1.0"

About how much disk space will rustup want? (That will determine which fs I will use for rustup, /opt or /usr/local.)

My x64 installation is currently using 1.3 gigabytes, and I assume it probably needs about twice that when doing an update.

Uninstall Debian's rust and cargo packages and never use them. Install official Rust from https://rustup.rs

Debian's policies are fundamentally incompatible with Rust's and crates.io ecosystem, and neither party will budge on this.

Right now only packages from Debian trixie are usable, but they're already getting old, and will soon also become a liability and a compatibility trap for the rest of trixie's lifetime.

The Rust project does not maintain any version of Rust shipped in Debian. Debian only has obsolete unsupported versions of Rust. Debian's packages aren't "stable", they're just old and abandoned, and don't receive any bugfixes nor compatibility improvements.

The crates.io ecosystem largely doesn't care about Debian's frozen-in-time dead Rust, and will cause you an endless pain if you insist on using Debian's Rust.

6 Likes