void-linux / void-packages

The Void source packages collection
https://voidlinux.org
Other
2.57k stars 2.14k forks source link

Some Rust packages build a lot of stuff during do_install #29207

Open ericonr opened 3 years ago

ericonr commented 3 years ago

At least rust-analyzer and angle-grinder. Example below

=> rust-analyzer-2021.03.01_2: running do_install ...
  Installing rust-analyzer v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/rust-analyzer)
    Updating crates.io index
warning: package `pin-project-lite v0.2.4` in Cargo.lock is yanked in registry `crates.io`, consider running without --locked
   Compiling once_cell v1.7.0
warning: Could not find `.git/HEAD` from manifest dir!
   Compiling countme v2.0.4
   Compiling thread_local v1.1.3
   Compiling profile v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/profile)
   Compiling rowan v0.12.6
   Compiling tracing-subscriber v0.2.16
   Compiling test_utils v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/test_utils)
   Compiling syntax v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/syntax)
   Compiling tracing-tree v0.1.8
   Compiling chalk-solve v0.58.0
   Compiling base_db v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/base_db)
   Compiling mbe v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/mbe)
   Compiling proc_macro_api v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/proc_macro_api)
   Compiling hir_expand v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/hir_expand)
   Compiling project_model v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/project_model)
   Compiling proc_macro_srv v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/proc_macro_srv)
   Compiling chalk-recursive v0.58.0
   Compiling hir_def v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/hir_def)
   Compiling hir_ty v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/hir_ty)
   Compiling hir v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/hir)
   Compiling ide_db v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/ide_db)
   Compiling ide_assists v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/ide_assists)
   Compiling ide_ssr v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/ide_ssr)
   Compiling ide_completion v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/ide_completion)
   Compiling ide v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/ide)
   Compiling rust-analyzer v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/rust-analyzer)
    Finished release [optimized] target(s) in 4m 07s
  Installing /destdir//rust-analyzer-2021.03.01/usr/bin/rust-analyzer
   Installed package `rust-analyzer v0.0.0 (/builddir/rust-analyzer-2021-03-01/crates/rust-analyzer)` (executable `rust-analyzer`)
warning: be sure to add `/destdir//rust-analyzer-2021.03.01/usr/bin` to your PATH to be able to run the installed binaries
=> rust-analyzer-2021.03.01_2: running post_install ...
leahneukirchen commented 3 years ago

Comparing with Nix and Arch shows that cargo install is not suitable for our purpose (and cannot be made), so I'd suggest we manually grab the binaries from the build dir as these distros do.

gbrlsnchs commented 3 years ago

This might have something to do with this issue I reported on Rust forums (now reported on Cargo's repo too). Overriding do_install to just grab the binary generated during do_build makes total sense to me. :slightly_smiling_face:

github-actions[bot] commented 2 years ago

Issues become stale 90 days after last activity and are closed 14 days after that. If this issue is still relevant bump it or assign it.

0x5c commented 2 years ago

I've hit this in https://github.com/void-linux/void-packages/pull/37013, and I know what might be happening in the case of all of those packages. Essentially cargo arbitrarily decides to drop a feature from a transient dependency (with no indication of why). You can see it when comparing the command cargo runs at build and at install for the deepest dependency that gets rebuilt (the command is shown when adding -vv).

In the case of #37013, the dependency that gets rebuilt is syn because cargo drops its full feature. There's no apparent reason for that drop, and it might even be a bug somewhere. The short-term fix was to explicitly add that feature for that dependency in the top crate's Cargo.toml.