keepass-diff icon indicating copy to clipboard operation
keepass-diff copied to clipboard

Unable to compile on the latest stable Debian

Open hax0rbana-adam opened this issue 7 months ago • 2 comments

Problem

Installing cargo using Debian's package manage and running the compilation command in the README results in the following error:

  Downloaded 73 crates (6.2 MB) in 37.24s (largest was `linux-raw-sys` at 2.3 MB)
error: failed to compile `keepass-diff v1.2.0`, intermediate artifacts can be found at `/tmp/cargo-installkk6alq`

Caused by:
  package `clap_derive v4.5.32` cannot be built because it requires rustc 1.74 or newer, while the currently active rustc version is 1.63.0
  Try re-running cargo install with `--locked`

Steps to reproduce

On Debian 12 (bookworm), run this:

sudo apt install -y cargo
git clone https://github.com/Narigo/keepass-diff
cd keepass-diff
RUSTFLAGS="-C target-cpu=native" cargo install keepass-diff

Solution

Based on the error message, it looks like it'd be possible to version lock to some version of linux-raw-sys which can be compiled without having to go through some special process to get a bleeding edge version of the rust compiler. I'm not a Rust developer, so I'm not familiar with how to go about this, but that seems like it would be the easiest solution.

Other options include:

  • Do not depend on libraries which do not support stable versions of Debian
  • Provide pre-compiled executables (which doesn't actually solve the problem of not being able to compile, but it'd be a reasonable workaround)
  • Document that this project can not be compiled with the stable versions of cargo/rustc and provide the commands to install the version of the compiler which is required

Workaround

Set up a VM or container with the testing version Debian (trixie) and run the same commands in the steps to reproduce. Observe that there are not any errors and ~/.cargo/bin/keepass-diff -h works as expected.

hax0rbana-adam avatar May 08 '25 18:05 hax0rbana-adam

I thought Cargo.lock would already have all dependencies locked... 😬 But I see the docker solution used rust:latest which is definitely not pinned. On my machine, I seem to have used rustc 1.73.0, which seems to be released in October 2023:

$ rustc --version
rustc 1.73.0 (cc66ad468 2023-10-03)

Wondering why it says it needs a newer version than what I have here. And an almost two year old version doesn't sound like bleeding edge to me anymore...

Anyways, I interprete the error message that you should run this command instead of the last one: RUSTFLAGS="-C target-cpu=native" cargo install --locked keepass-diff

If that works, it could be an easier workaround than changing the VM...

Narigo avatar May 09 '25 14:05 Narigo

That --locked keepass-diff didn't seem to have any effect on head, but it worked just fine on the 1.1.3 tag!

So that gives me a workaround, and I'd consider this closed if it were just documented in the build instructions that 1.1.3 is the latest version which will compile (seemingly with or without the --locked option).

Thanks for writing and maintaining this tool! If you accept donations, I'd be willing to send you a few sats as a proper thank you.

Long term support

I concede your point about a 19 month old release not being bleeding edge. Poor choice of words on my part.

That aside, the latest stable Debian release was 23 months ago, so it couldn't have included 1.73.0. There's likely going to be a new release of Debian sometime this year which will resolve this, but I fear that we'll just be in the same situation in a couple of months because rust is only supported for 6 weeks. There's no long term support branch that gets patches but doesn't bolt on more features.

This explains why packages are constantly requiring new compiler versions which aren't in any stable distros, and why compiling rust programs is very frequently an uphill battle, at least for users who are not also rust developers.

hax0rbana-adam avatar May 10 '25 19:05 hax0rbana-adam