cargo install in a workspace gives confusing errors
Problem
Running cargo install in a workspace gives a confusing error:
error: found a virtual manifest at `/Users/william/development/rsidm/Cargo.toml` instead of a package manifest
Attempting to use a manifest (which is what the common google searches tell you to do) also errors:
cargo install --manifest-path kanidm_tools/Cargo.toml
error: Found argument '--manifest-path' which wasn't expected, or isn't valid in this context
This is because all the current online uses seem to be cargo build not cargo install (is anyone installing anything?).
As well, the other suggested option is --all: which also fails:
cargo install --all
error: Found argument '--all' which wasn't expected, or isn't valid in this context
Did you mean --all-features?
Steps
- create a workspace with multiple members.
- in the workspace run "cargo install" 3.
Possible Solution(s) cargo install in a workspace could
- give a better or constructive error such as "did you mean to use --path"?
- make --all mean something
- just work by default (install all binaries of the workspace)
Notes
Somewhat of a duplicate of #4101 and #7124, but I'll leave this open since it is clearly written. :smile:
now cargo install --path <binary_crate> works, it's great! my rustc version is rustc 1.43.1 (8d69840ab 2020-05-04), thanks your nice job!
Any recent updates on this issue or plans of addressing it? I also ran into the confusion of trying to run cargo install from the root of my workspace and not understanding the error message. But it definitely would be nice if it behaved the same as cargo build from the workspace root behaves, where it acts upon all packages in the workspace.
^^ re-up, agreed. Why would cargo build work but not cargo install? This seems like a bug.
i get this error too...what is solution please?
I tried cargo build and got this error: error: linking with cc failed: exit status: 1
TLDR fix: specify the path to the executable package with --path <binary-package-path>, in my case:
cargo install --path packages_rs/nextclade-cli
Fixed this error:
$ cargo install
error: found a virtual manifest at `/Users/corneliusromer/code/nextclade/Cargo.toml` instead of a package manifest
For a repo with this structure where the current work directory is the root:
.
├── Cargo.toml
└── packages_rs
├── nextclade
└── Cargo.toml
├── nextclade-cli
└── Cargo.toml
└── nextclade-web
└── Cargo.toml
I totally agree that the error message should be more helpful. The bad error message is surprising given Rust's usually very helpful errors.
#7194 is somewhat similar in that part of the problem is that path sources (both cargo install and dependencies) are non-recursive and we try to load that Cargo.toml itself.