Skip to content

can't find crate for 'XYZ' (windows-msvc only) #15137

Open
@newfla

Description

Hi,
I'm unable to build the diffusion-rs library using x86_64-pc-windows-msvc toolchain.
First time that I had this issue was in November when using gh runner logs: at the time I didn't give too much weight to the problem since on my Windows machine it compiled correctly and I assumed there was some problem with windows runner.
Since last Wednesday I've been having the same issue on my local machine too: I've tried toolchian from 1.80 to 1.84.1 (+ nightly) with the same result.
Linux and Macos work just fine.
I'm pretty sure I have seen some updates to vs build tools running in windows update but i don't recall which they are precisely.

Build command: cargo build

Let me know if there is any other information I can provide

Backtrace

error[E0463]: can't find crate for `hf_hub`
 --> src\modifier.rs:1:5
  |
1 | use hf_hub::api::sync::ApiError;
  |     ^^^^^^ can't find crate

error[E0463]: can't find crate for `hf_hub`
 --> src\preset_builder.rs:7:5
  |
7 | use hf_hub::api::sync::ApiError;
  |     ^^^^^^ can't find crate

error[E0463]: can't find crate for `hf_hub`
 --> src\util.rs:6:5
  |
6 | use hf_hub::api::sync::{ApiBuilder, ApiError};
  |     ^^^^^^ can't find crate

error[E0463]: can't find crate for `derive_builder`
 --> src\api.rs:9:5
  |
9 | use derive_builder::Builder;
  |     ^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `thiserror`
  --> src\api.rs:15:5
   |
15 | use thiserror::Error;
   |     ^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `derive_builder`
 --> src\preset.rs:1:5
  |
1 | use derive_builder::Builder;
  |     ^^^^^^^^^^^^^^ can't find crate

error[E0463]: can't find crate for `hf_hub`
 --> src\preset.rs:2:5
  |
2 | use hf_hub::api::sync::ApiError;
  |     ^^^^^^ can't find crate

error[E0432]: unresolved imports `crate::api::ConfigBuilder`, `crate::api::ConfigBuilderError`
 --> src\preset.rs:5:25
  |
5 |     api::{self, Config, ConfigBuilder, ConfigBuilderError},
  |                         ^^^^^^^^^^^^^  ^^^^^^^^^^^^^^^^^^ no `ConfigBuilderError` in `api`
  |                         |
  |                         no `ConfigBuilder` in `api`

error[E0432]: unresolved import `crate::api::ConfigBuilder`
 --> src\modifier.rs:4:11
  |
4 |     api::{ConfigBuilder, SampleMethod},
  |           ^^^^^^^^^^^^^ no `ConfigBuilder` in `api`

error[E0432]: unresolved import `crate::api::ConfigBuilder`
 --> src\preset_builder.rs:9:13
  |
9 | use crate::{api::ConfigBuilder, util::download_file_hf_hub};
  |             ^^^^^^^^^^^^^^^^^^ no `ConfigBuilder` in `api`

error: cannot find attribute `error` in this scope
  --> src\api.rs:38:7
   |
38 |     #[error("The underling stablediffusion.cpp function returned NULL")]
   |       ^^^^^

error: cannot find attribute `error` in this scope
  --> src\api.rs:40:7
   |
40 |     #[error("The underling stbi_write_image function returned 0 while saving image {0}/{1})")]
   |       ^^^^^

error: cannot find attribute `error` in this scope
  --> src\api.rs:42:7
   |
42 |     #[error("The underling upsclaer model returned a NULL image")]
   |       ^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:59:3
   |
59 | #[builder(setter(into, strip_option), build_fn(validate = "Self::validate"))]
   |   ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:64:7
   |
64 |     #[builder(default = "num_cpus::get_physical() as i32", setter(custom))]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:68:7
   |
68 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:72:7
   |
72 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:76:7
   |
76 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:80:7
   |
80 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:84:7
   |
84 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:88:7
   |
88 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:92:7
   |
92 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\api.rs:96:7
   |
96 |     #[builder(default = "Default::default()")]
   |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:100:7
    |
100 |     #[builder(default = "Default::default()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:104:7
    |
104 |     #[builder(default = "Default::default()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:108:7
    |
108 |     #[builder(default = "Default::default()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:112:7
    |
112 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:116:7
    |
116 |     #[builder(default = "Default::default()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:120:7
    |
120 |     #[builder(default = "0")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:124:7
    |
124 |     #[builder(default = "WeightType::SD_TYPE_COUNT")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:128:7
    |
128 |     #[builder(default = "Default::default()", setter(custom))]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:132:7
    |
132 |     #[builder(default = "Default::default()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:136:7
    |
136 |     #[builder(default = "Default::default()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:140:7
    |
140 |     #[builder(default = "PathBuf::from(\"./output.png\")")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:147:7
    |
147 |     #[builder(default = "\"\".into()")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:151:7
    |
151 |     #[builder(default = "7.0")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:155:7
    |
155 |     #[builder(default = "3.5")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:159:7
    |
159 |     #[builder(default = "0.75")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:163:7
    |
163 |     #[builder(default = "20.0")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:168:7
    |
168 |     #[builder(default = "0.9")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:172:7
    |
172 |     #[builder(default = "512")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:176:7
    |
176 |     #[builder(default = "512")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:180:7
    |
180 |     #[builder(default = "SampleMethod::EULER_A")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:184:7
    |
184 |     #[builder(default = "20")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:188:7
    |
188 |     #[builder(default = "RngFunction::CUDA_RNG")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:192:7
    |
192 |     #[builder(default = "42")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:196:7
    |
196 |     #[builder(default = "1")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:200:7
    |
200 |     #[builder(default = "Schedule::DEFAULT")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:205:7
    |
205 |     #[builder(default = "ClipSkip::Unspecified")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:209:7
    |
209 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:213:7
    |
213 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:217:7
    |
217 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:221:7
    |
221 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:225:7
    |
225 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:229:7
    |
229 |     #[builder(default = "None", private)]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:235:7
    |
235 |     #[builder(default = "false")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:240:7
    |
240 |     #[builder(default = "0.")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:244:7
    |
244 |     #[builder(default = "vec![7, 8, 9]")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:248:7
    |
248 |     #[builder(default = "0.01")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
   --> src\api.rs:252:7
    |
252 |     #[builder(default = "0.2")]
    |       ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\preset.rs:79:3
   |
79 | #[builder(
   |   ^^^^^^^

error: cannot find attribute `builder` in this scope
  --> src\preset.rs:88:7
   |
88 |     #[builder(private, default = "Vec::new()")]
   |       ^^^^^^^

error[E0412]: cannot find type `ConfigBuilder` in this scope
   --> src\api.rs:256:6
    |
256 | impl ConfigBuilder {
    |      ^^^^^^^^^^^^^ not found in this scope

error[E0412]: cannot find type `ConfigBuilderError` in this scope
   --> src\api.rs:274:38
    |
274 |     fn validate(&self) -> Result<(), ConfigBuilderError> {
    |                                      ^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: you might be missing a type parameter
    |
256 | impl<ConfigBuilderError> ConfigBuilder {
    |     ++++++++++++++++++++

error[E0412]: cannot find type `ConfigBuilderError` in this scope
   --> src\api.rs:279:44
    |
279 |     fn validate_model(&self) -> Result<(), ConfigBuilderError> {
    |                                            ^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: you might be missing a type parameter
    |
256 | impl<ConfigBuilderError> ConfigBuilder {
    |     ++++++++++++++++++++

error[E0412]: cannot find type `ConfigBuilderError` in this scope
   --> src\api.rs:289:49
    |
289 |     fn validate_output_dir(&self) -> Result<(), ConfigBuilderError> {
    |                                                 ^^^^^^^^^^^^^^^^^^ not found in this scope
    |
help: you might be missing a type parameter
    |
256 | impl<ConfigBuilderError> ConfigBuilder {
    |     ++++++++++++++++++++

error[E0412]: cannot find type `PresetBuilder` in this scope
  --> src\preset.rs:92:6
   |
92 | impl PresetBuilder {
   |      ^^^^^^^^^^^^^ not found in this scope

error[E0433]: failed to resolve: use of undeclared type `ConfigBuilderError`
   --> src\api.rs:284:20
    |
284 |             .ok_or(ConfigBuilderError::UninitializedField(
    |                    ^^^^^^^^^^^^^^^^^^ use of undeclared type `ConfigBuilderError`

error[E0433]: failed to resolve: use of undeclared type `ConfigBuilderError`
   --> src\api.rs:295:17
    |
295 |             Err(ConfigBuilderError::ValidationError(
    |                 ^^^^^^^^^^^^^^^^^^ use of undeclared type `ConfigBuilderError`

Some errors have detailed explanations: E0412, E0432, E0433, E0463.
For more information about an error, try `rustc --explain E0412`.
error: could not compile `diffusion-rs` (lib) due to 69 previous errors
PS C:\Users\newfl\diffusion-rs> 

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bugO-windowsOS: WindowsS-triageStatus: This issue is waiting on initial triage.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions