Skip to content

Outdated dependencies causing build failure on rustc ≥1.71 #12

Open
@kir68k

Description

@kir68k

Hi, I wanted to package this program for my distribution and personal package repository, but when trying to build, it fails to compile due to a dependency.

System info

~ ¥ rustc -V
rustc 1.73.0-nightly (b3df56a65 2023-07-31) (gentoo)

Ebuild for colorgen-nvim

I at first thought maybe it's due to making the ebuild file wrong, so I cloned the repository locally and ran cargo build while in it, giving the same failure as through the distro package manager:

~/Documents/Git/Dissociated/colorgen-nvim ¥ cargo build
   Compiling proc-macro2 v1.0.56
   Compiling io-lifetimes v1.0.10
   Compiling indexmap v1.9.3
   Compiling thiserror v1.0.40
   Compiling minimal-lexical v0.2.1
   Compiling once_cell v1.17.1
   Compiling bitflags v2.2.1
   Compiling rustix v0.37.18
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/kir68k/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
Exception: cargo exited with 101
[tty 68]:1:1: cargo build

I noticed a few of the dependencies in Cargo.lock are outdated, so I ran cargo update.
After cargo update, I ran cargo build which could build the project correctly:

   [...]
   Compiling toml v0.7.6
   Compiling clap v4.3.19
   Compiling colorgen-nvim v0.3.0 (/home/kir68k/Documents/Git/Dissociated/colorgen-nvim)
    Finished dev [unoptimized + debuginfo] target(s) in 16.15s

Doing git reset --hard HEAD and building again causes the failure as expected.

Since my primary rustc is built from the most recent git commit, hence v1.73, I installed rust-bin alongside to test if it works on v1.71, the most recent version in my distro's repositories, and the latest release on GitHub.

~/Documents/Git/Dissociated/colorgen-nvim ¥ cargo-bin-1.71.0 build
   Compiling quote v1.0.26
   Compiling proc-macro2 v1.0.56
   Compiling serde v1.0.160
   Compiling io-lifetimes v1.0.10
   Compiling memchr v2.5.0
   Compiling colorchoice v1.0.0
   Compiling indexmap v1.9.3
   Compiling anstyle-query v1.0.0
   Compiling anstyle v1.0.0
   Compiling strsim v0.10.0
   Compiling thiserror v1.0.40
   Compiling clap_lex v0.4.1
error[E0635]: unknown feature `proc_macro_span_shrink`
  --> /home/kir68k/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.56/src/lib.rs:92:30
   |
92 |     feature(proc_macro_span, proc_macro_span_shrink)
   |                              ^^^^^^^^^^^^^^^^^^^^^^

   Compiling rustix v0.37.18
For more information about this error, try `rustc --explain E0635`.
error: could not compile `proc-macro2` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
Exception: cargo-bin-1.71.0 exited with 101
[tty 106]:1:1: cargo-bin-1.71.0 build

I also tried rustc v1.70 through nix shell nixpkgs#{rustc,cargo}, and on that version it builds fine, so this is an issue starting on v1.71, fixed by bumping proc-macro2 to v1.0.66.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions