nabijaczleweli / cargo-update

A cargo subcommand for checking and applying updates to installed executables
MIT License
1.22k stars 42 forks source link

Error running "cargo install cargo-update" on Ubuntu 24.04.1 LTS #277

Closed cpsyctc2 closed 2 weeks ago

cpsyctc2 commented 2 weeks ago

I hope this is a sensible place to report this. This has been consistent for me over a few days now on Ubuntu 24.04.1 LTS on two separate machines. I get the error running topgrade

── 08:02:19 - Cargo ────────────────────────────────────────────────────────────
cargo-update isn't installed so Topgrade can't upgrade cargo packages.
Install cargo-update by running `cargo install cargo-update`

When I run cargo install-update I get all of this (giving all in case it is useful, error is at the end)

# cargo install cargo-update
    Updating crates.io index
  Installing cargo-update v14.1.1
    Updating crates.io index
   Compiling libc v0.2.159
   Compiling shlex v1.3.0
   Compiling pkg-config v0.3.31
   Compiling serde v1.0.210
   Compiling vcpkg v0.2.15
   Compiling semver v1.0.23
   Compiling io-lifetimes v1.0.11
   Compiling equivalent v1.0.1
   Compiling hashbrown v0.14.5
   Compiling winnow v0.6.20
   Compiling rustix v0.37.27
   Compiling proc-macro2 v1.0.86
   Compiling tinyvec_macros v0.1.1
   Compiling autocfg v1.4.0
   Compiling unicode-ident v1.0.13
   Compiling linux-raw-sys v0.3.8
   Compiling tinyvec v1.8.0
   Compiling bitflags v1.3.2
   Compiling percent-encoding v2.3.1
   Compiling memchr v2.7.4
   Compiling unicode-bidi v0.3.15
   Compiling form_urlencoded v1.2.1
   Compiling indexmap v1.9.3
   Compiling indexmap v2.5.0
   Compiling hashbrown v0.12.3
   Compiling curl v0.4.46
   Compiling openssl-probe v0.1.5
   Compiling quote v1.0.37
   Compiling unicode-normalization v0.1.24
   Compiling os_str_bytes v6.6.1
   Compiling log v0.4.22
   Compiling syn v2.0.79
   Compiling clap_lex v0.2.4
   Compiling termcolor v1.4.1
   Compiling bitflags v2.6.0
   Compiling unicode-width v0.1.14
   Compiling once_cell v1.19.0
   Compiling strsim v0.10.0
   Compiling idna v0.5.0
   Compiling tabwriter v1.4.0
   Compiling hex v0.4.3
   Compiling array_tool v1.0.3
   Compiling json-deserializer v0.4.4
   Compiling jobserver v0.1.32
   Compiling atty v0.2.14
   Compiling socket2 v0.5.7
   Compiling url v2.5.2
   Compiling home v0.5.9
   Compiling cc v1.1.22
   Compiling openssl-sys v0.9.103
   Compiling libz-sys v1.1.20
   Compiling libnghttp2-sys v0.1.10+1.61.0
   Compiling libssh2-sys v0.3.0
   Compiling curl-sys v0.4.76+curl-8.10.1
   Compiling libgit2-sys v0.17.0+1.8.1
   Compiling terminal_size v0.2.6
   Compiling serde_derive v1.0.210
   Compiling textwrap v0.16.1
   Compiling toml_datetime v0.6.8
   Compiling serde_spanned v0.6.8
   Compiling clap v3.2.25
   Compiling toml_edit v0.22.22
   Compiling rustc_version v0.4.1
   Compiling toml v0.8.19
   Compiling embed-resource v2.5.0
   Compiling cargo-update v14.1.1
error: unsupported output in build script of `curl-sys v0.4.76+curl-8.10.1`: `cargo::rustc-check-cfg=cfg(libcurl_vendored,link_libnghttp2,link_libz,link_openssl,)`
Found a `cargo::key=value` build directive which is reserved for future use.
Either change the directive to `cargo:key=value` syntax (note the single `:`) or upgrade your version of Rust.
See https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script for more information about build script outputs.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `cargo-update v14.1.1`, intermediate artifacts can be found at `/tmp/cargo-installXMO4jf`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.

Watching the process I think the error comes up at "103/113" in the processing of cargo-update.

I am just a Linux/Ubuntu end user but happy to report more information about the two systems and do anything that maybe helpful if I am given fairly luser-proof instructions.

TIA,

Chris

nabijaczleweli commented 2 weeks ago

Ah yes, the cargo::whatever syntax that appeared magically in one release with a "use cargo::whatever instead of cargo:whatever" warning, with no deprecation period for cargo:whatever and old compilers not supporting cargo::whatever.

FTR,

error: unsupported output in build script of curl-sys v0.4.76+curl-8.10.1: cargo::rustc-check-cfg=cfg(libcurl_vendored,link_libnghttp2,link_libz,link_openssl,)

means this is error originates in curl-sys.

The error says

Either change the directive to cargo:key=value syntax (note the single :) or upgrade your version of Rust.

and I am loathe to ask this but what does rustc --version/cargo --version say? Did you get your cargo from apt (in general I'm in support of this, but.)?

cpsyctc2 commented 2 weeks ago

Many thanks for that.

I am sorry but I don't know whence I got cargo, I would have guessed from apt as that's my preferred option but it's possible that I followed something asking me to get it some other way. (Plea in mitigation: I've been through installing so many things for the rebuild I have only really kept notes on the things that failed immediately, this was OK at first I believe. What I get is:

root@clevorebuilt:/home/chris# rustc --version
rustc 1.75.0 (82e1608df 2023-12-21) (built from a source tarball)
root@clevorebuilt:/home/chris# cargo --version
cargo 1.75.0

I am guessing that says that I have two instances of cargo with the same version number but perhaps from different sources. Or perhaps not! Does it help at all?

nabijaczleweli commented 2 weeks ago

Well, you can tell if it's from apt by asking it (dpkg -l rustc cargo (or apt list rustc cargo)). If that doesn't say ii cargo... then command -v cargo will probably say $HOME/.cargo/bin/cargo and that indicates rustup). But packages.ubuntu.com says "noble (24.04LTS)" has rustc 1.75.0+dfsg0ubuntu1-0ubuntu7, which aligns with your version, and if it were from rustup you'd have something closer to 1.80. So you probably have cargo from apt.

This is something I personally like to support (well, latest debian stable, but that's a little older than yours). But this is in a dependency, so I can only forward this to curl-sys and hope their compat policy aligns with mine.

If you'd instead like to "just get this to work", you probably want to install rust/cargo from rustup, cf. https://rustup.rs. (You can then apt remove rustc cargo, and keep using the version from rustup (and rustup update) in perpetuity. This is not optimal, but the rust ecosystem is unfortunately focused on breaking as much compatibility as often as possible.)

nabijaczleweli commented 2 weeks ago

Looks reported in https://github.com/alexcrichton/curl-rust/issues/576 already

cpsyctc2 commented 2 weeks ago

Thanks @nabijaczleweli I clearly had the apt install (and thanks to you I have learned useful things about how to find out whether apt is the source of a package/program!) Like you, I would much prefer to stay with the Ubuntu repositories as my primary source of things but I decided that this time I would go for the "just work" and removed the existing installs and pulled rust/cargo from rustup and then cargo install-update worked. Many thanks, Chris

nabijaczleweli commented 2 weeks ago

Should now work on ubuntu cargo by pulling in curl-rust 0.4.77.