-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cargo install in a workspace gives confusing errors #7599
Comments
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update tests for coverage. Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update tests for coverage. Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update tests for coverage. Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update tests for coverage. Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update tests for coverage. Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update tests for coverage. Signed-off-by: Chris Patterson <[email protected]>
Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update unit tests for coverage and add a spead test. Signed-off-by: Chris Patterson <[email protected]>
If a plugin detects an error prior to attempting to build a part's source, it can raise SnapcraftPluginAssertionError() with a brief reason and optional details. SnapcraftEnvironmentError() was also a viable choice, but it's slated to be nuked and as it is too generic. This seems like a fair middle ground that can be re-used across the the plugins when they make an assertion that fails to check out at runtime. Unfortunately, `cargo install` does not support workspaces yet: rust-lang/cargo#7599 Alternatively, we use `cargo build`, which will respect the Cargo.lock configuration. It however, does require a bit more hoop jumping to determine which binaries were built and install them. Introudce _install_workspace_artifacts() to install the built executables into the correct paths. Testing has covered executables and libraries, though dynamic linking is not quite yet supported by the rust plugin (at least in my testing, it will have unmnet dependencies on libstd-<id>.so). We can address that feature gap in the future, but likely doesn't affect snap users because they are probably using the standard linking process which doesn't require libstd (likely due to static linking of those dependencies). `cargo build` has an unstable flag option for `--out-dir` which may simplifiy the install process, but is currently unavailable for stable use: https://doc.rust-lang.org/cargo/reference/unstable.html#out-dir Add/update unit tests for coverage and add a spead test. Signed-off-by: Chris Patterson <[email protected]>
now |
Any recent updates on this issue or plans of addressing it? I also ran into the confusion of trying to run |
^^ 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 |
The `%{cargo_install}` macro is expanded adding a `--path .` paramenter at the end. With virtual workspaces we need to specify a different `path` per binary crate, but this cannot be done if there is already one `path` parameter. This patch removes the `--path .` parameter, so an user can now use: %{cargo_install} --path binary-crate Related with: rust-lang/cargo#7599 Signed-off-by: Alberto Planas <[email protected]>
The `%{cargo_install}` macro is expanded adding a `--path .` paramenter at the end. With virtual workspaces we need to specify a different `path` per binary crate, but this cannot be done if there is already one `path` parameter. This patch adds a path parameter (-p) in the cargo_install macro, that if it is not present will default to the current "--path ." one. Now an user can specify a different path parameter: %{cargo_install -p binary-crate} --no-default-features Related with: rust-lang/cargo#7599 Signed-off-by: Alberto Planas <[email protected]>
The `%{cargo_install}` macro is expanded adding a `--path .` paramenter at the end. With virtual workspaces we need to specify a different `path` per binary crate, but this cannot be done if there is already one `path` parameter. This patch adds a path parameter (-p) in the cargo_install macro, that if it is not present will default to the current "--path ." one. Now an user can specify a different path parameter: %{cargo_install -p binary-crate} --no-default-features Related with: rust-lang/cargo#7599 Signed-off-by: Alberto Planas <[email protected]>
TLDR fix: specify the path to the executable package with 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 |
For some reason, cargo install and cargo build do not do exactly the same thing. My commit at ed6ce14 broke cargo install without us noting it or CI catching it. This commit adds a test to cover this. It should be noted that Rust does not yet cargo install with workspace, so we need to point it to each of the individual binaries that we want to install, for reference see: - rust-lang/cargo#7599 - rust-lang/cargo#4101 - rust-lang/cargo#7124 We install each of the binaries into a temporary directory that will be cleaned up automatically by the runner when the job finishes. Signed-off-by: Arnaud de Grandmaison <[email protected]>
For some reason, cargo install and cargo build do not do exactly the same thing. My commit at ed6ce14 broke cargo install without us noting it or CI catching it. This commit adds a test to cover this. It should be noted that cargo install does not yet (or still does not !) play nice with workspace, so we need to point it to each of the individual binaries that we want to install, for reference see: - rust-lang/cargo#7599 - rust-lang/cargo#4101 - rust-lang/cargo#7124 We install each of the binaries into a temporary directory provided by the runner and that will be cleaned up automatically when the job finishes. Signed-off-by: Arnaud de Grandmaison <[email protected]>
For some reason, cargo install and cargo build do not do exactly the same thing. My commit at Arnaud-de-Grandmaison-ARM@ed6ce14 broke cargo install without us noting it or CI catching it. This commit adds a test to cover this. It should be noted that cargo install does not yet (or still does not !) play nice with workspace, so we need to point it to each of the individual binaries that we want to install, for reference see: - rust-lang/cargo#7599 - rust-lang/cargo#4101 - rust-lang/cargo#7124 We install each of the binaries into a temporary directory provided by the runner and that will be cleaned up automatically when the job finishes. Signed-off-by: Arnaud de Grandmaison <[email protected]>
Problem
Running cargo install in a workspace gives a confusing error:
Attempting to use a manifest (which is what the common google searches tell you to do) also errors:
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:
Steps
Possible Solution(s)
cargo install in a workspace could
Notes
The text was updated successfully, but these errors were encountered: