Cannot compile the ring crate: file not found for

2019-07-20 17:33发布

问题:

Cargo is not compiling with the following error:

$ cargo build
Compiling ring v0.12.1
error[E0583]: file not found for module `montgomery`
    --> 
 C:\Users\jmccrae\.cargo\registry\src\github.com1ecc6299db9ec823\ring-0.12.1\src\arithmetic/arithmetic.rs:15:9
   |
15 | pub mod montgomery;
   |         ^^^^^^^^^^
   |
   = help: name the file either arithmetic\montgomery.rs or arithmetic\montgomery\mod.rs inside the directory 
"C:\\Users\\jmccrae\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\ring-0.12.1\\src\\arithmetic"

The project was a new project with Cargo.toml modified to include a dependency to the most recent version (0.12.1) of the ring crate. The Cargo.toml is as follows:

[package]
name = "testring"
version = "0.1.0"
authors = ["John McCrae <john@mccr.ae>"]

[dependencies]
ring = "0.12.1"

The required file seems to actually exist:

$ ls  C:\\Users\\jmccrae\\.cargo\\registry\\src\\github.com-1ecc6299db9ec823\\ring-0.12.1\\src\\arithmetic
arithmetic.rs  montgomery.rs

The cargo version is cargo 0.25.0-nightly (930f9d949 2017-12-05) and it is running on MINGW.

Is there anything wrong with the compiler set-up?

回答1:

This is an issue with Ring and Rust 1.24.0-nightly (2017-12-21). It also has an associated issue in the Rust repository.

To work around it, use an older version of Rust nightly (or avoid nightly if you can).