rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.69k stars 2.41k forks source link

Package `ndarray v0.4.0` does not have these features: `complex` #2472

Closed daniel-vainsencher closed 8 years ago

daniel-vainsencher commented 8 years ago

I've changed cargo.toml to depend on ndarray=0.4 (without yet using it from the code at all) and suddenly get the above error message very early in building my package (right after Updating the registry).

I have no idea where to start: is any particular line of code or configuration requiring the feature 'complex'? why is it required specifically of ndarray? it does not seem to be a feature provided by ndarray according to https://github.com/bluss/rust-ndarray#recent-changes

alexcrichton commented 8 years ago

Does any crate in the dependency graph require the complex feature from ndarray and is accidentally picking up 0.4.0 when it actually only works with 0.3.0 perhaps?

The error message here could probably be much better though! Do you have a reproduction I could play around with as well?

daniel-vainsencher commented 8 years ago

Unfortunately, this particular project is private. I have worked around the problem by removing

[dependencies.libc]

From cargo.toml. Adding that line to the cargo.toml of another project that uses ndarray doesn't reproduce the problem, unfortunately.

Yes, the issue is definitely about the error message, of course. Even in easier cases I am sure it could give a lot more information.

alexcrichton commented 8 years ago

Hm that may just be a case where the resolver is being somewhat nondeterministic. Do you have a public project I could poke at? In theory all that's needed to reproduce are the Cargo.toml files.

daniel-vainsencher commented 8 years ago

I am now failing to reproduce the problem, both on a clean project and on the original, so cannot help find the problem :/

I hope the error message can still be improved in a general way.

Ryman commented 8 years ago

@alexcrichton Similar error if you try using a Cargo.toml with only ffmpeg = "*" as a dependency in a fresh project.

cargo update          (or cargo build for initial build)                                                                                             
    Updating registry `https://github.com/rust-lang/crates.io-index`
Package `ffmpeg v0.1.0` does not have these features: `swscale, avcodec, swresample, avdevice, postproc, avfilter, avformat, avresample`

Note that there are versions published after 0.1.0.

This works with the cargo released with 1.7, fails on 1.8.0-beta.1 and recent 1.9.0 nightly. 1.7 pulls in v0.2.0-alpha.1 (which fails to build for other reasons)

EDIT(More info): If you change to ffmpeg = '0.1.1' on beta or nightly, you get another error about not finding a version, due to how ffmpeg-sys has done it's versioning numbers e.g. 2.6.2-5, you get an error:

    Updating registry `https://github.com/rust-lang/crates.io-index`
no matching package named `ffmpeg-sys` found (required by `ffmpeg`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: ^2.6.2

Again, this works on stable (just fails to build because of using features on stable).

It looks like it's related to semver parsing?

bluss commented 8 years ago

FYI ndarray uses complex from num https://github.com/bluss/rust-ndarray/blob/master/Cargo.toml#L25-L28 Seems like a weird bug (mixing up which package the feature belongs to) for that reason.

(ndarray itself has never had a feature called complex).

alexcrichton commented 8 years ago

This looks to be a bug in resolution. When it's backtracking some feature set's not getting cleared out so it's leaking from one dependency to another. Hope to have a fix soon!

daniel-vainsencher commented 8 years ago

Thanks for the sleuthing!

On Wed, Mar 16, 2016 at 9:04 PM, bors notifications@github.com wrote:

Closed #2472 https://github.com/rust-lang/cargo/issues/2472 via #2484 https://github.com/rust-lang/cargo/pull/2484.

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/rust-lang/cargo/issues/2472#event-592737320

Daniel Vainsencher