rustrust-cargorust-crates

What causes a spurious "<dependency> required to be available in rlib format, but was not found in this form" error?


When running cargo check with a fresh target/ directory, I got this error:

crate `hyper` required to be available in rlib format, but was not found in this form

No other details were output about it and other dependencies above and below hyper were checked successfully. Running cargo check again yielded the same error and didn't re-check anything. I know hyper is a Rust library that should definitely be available as an rlib. Making a change to local package did not fix anything. This was using an unchanged Cargo.lock file that worked before.

Why is this failing like this?


Solution

  • cargo clean
    

    seems to have resolved the error. I found this similar post on the Rust users' forum where the symptoms and resolution was the same.

    It seems to have been a spurious build artifact failure. Perhaps it didn't write the .rlib file? Maybe some other metadata got lost? Like I said, there wasn't any other error message when it first appeared and since I've cargo clean'd I can no longer investigate the state of the target/ directory.