-
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
fails when package uses previous version of its own to build itself
#11999
Comments
A reproduction test case: #[cargo_test]
fn self_referetial() {
Package::new("foo", "0.0.1")
.file("src/lib.rs", "fn hello() {}")
.file("src/main.rs", "fn main() {}")
.file("build.rs", "fn main() {}")
.publish();
Package::new("foo", "0.0.2")
.file("src/lib.rs", "fn hello() {}")
.file("src/main.rs", "fn main() {}")
.file("build.rs", "fn main() {}")
.build_dep("foo", "0.0.1")
.publish();
cargo_process("install foo")
.with_stderr(
"\
[UPDATING] `[..]` index
[DOWNLOADING] crates ...
[DOWNLOADED] foo v0.0.1 (registry [..])
[INSTALLING] foo v0.0.1
[COMPILING] foo v0.0.1
[FINISHED] release [optimized] target(s) in [..]
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
",
)
.run();
assert_has_installed_exe(cargo_home(), "foo");
} |
Most likely these lines: // When we build this package, we want to build the *specified* package only,
// and avoid building e.g. workspace default-members instead. Do so by constructing
// specialized compile options specific to the identified package.
// See test `path_install_workspace_root_despite_default_members`.
let mut opts = original_opts.clone();
opts.spec = Packages::Packages(vec![pkg.name().to_string()]); |
I've run into this sort of issue with another package as well (unfortunately, I no longer have the work machine I used when I hit it... I think it was something tokio related.) There, the issue was that the "workspace" seemed to contain both a package with a particular name (idk, So we could either:
Or perhaps most likely: first do 1, then break 2 into a separate issue. I can take a crack at a fix tomorrow, if someone doesn't beat me to it. |
I believe this is the correct way to resolve the issue. |
Problem
Hello!
My package
tokay
uses a previous version of its own to build itself. It worked until Rust toolchain 1.67.1, but since 1.68.0 this is broken and I cannot find a solution for it.Here's what happens with Rust toolchain 1.68.2 (stable):
The provided hint doesn't help as well, because I cannot specify
-p [email protected]
together withcargo install
, as its probably acargo build
command.As written,
tokay
uses a previous version of its own as build-dependency, and also in dependency of a dependency.Therefore, to build
tokay 0.6.2
,tokay 0.4.0
is required bybuild.rs
and bytokay-macros
.Here are the dependencies as specified in
Cargo.toml
:Steps
cargo install tokay
Possible Solution(s)
I don't have any solutions for this problem.
I've tried to use another name for the older package version in the build dependencies, but this also didn't work.
I haven't tried it in the
tokay-macros
package as well, as I first have to publish this packages, andtokay
afterwards, just to test it.Notes
When I run
cargo build
orcargo run
in my checked out repository, all works as expected, also with the newest 1.68 toolchain.Thanks for any help!
Version
The text was updated successfully, but these errors were encountered: