Skip to content
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

error: building from local source while REQUIRED_RUST_TOOLCHAIN doesn't match rust-toolchain.toml. #172

Open
nilanjan opened this issue Dec 9, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@nilanjan
Copy link

nilanjan commented Dec 9, 2024

Expected Behaviour

Build cargo run --bin example-runner-wgpu or cargo run --bin example-runner-ash successfully on macos.

Example & Steps To Reproduce

  1. Clone the repo on macos.
  2. Install rust environment etc.
  3. Run build command cargo run --bin example-runner-wgpu

System Info

  • Rust: [nightly-2024-04]
  • OS: [macOS 15.1.1]
  • GPU: [Apple M1 Max]
  • SPIR-V: [SPIRV-Tools v2024.4 v2024.4.rc1-0-g6dcc7e35, Target: SPIR-V 1.6]

Backtrace

Summary:

Error Cause: The rustc_codegen_spirv build script requires a specific Rust toolchain version, which does not match the version specified in rust-toolchain.toml.
Standard Output: A notification to rerun the build if the environment variable RUSTGPU_SKIP_TOOLCHAIN_CHECK changes.
Standard Error: Clearly states the toolchain mismatch as the cause of the build failure.

   Compiling internal-iterator v0.2.3
   Compiling pin-project-lite v0.2.15
   Compiling profiling v1.0.16
   Compiling same-file v1.0.6
   Compiling futures-task v0.3.31
   Compiling futures-io v0.3.31
   Compiling pin-utils v0.1.0
   Compiling longest-increasing-subsequence v0.1.0
   Compiling spirv-std-types v0.9.0 (/Users/nilg/Workspace/Code/Rust/rust-gpu/crates/spirv-std/shared)
   Compiling litrs v0.4.1
   Compiling futures-util v0.3.31
   Compiling spirv-std-macros v0.9.0 (/Users/nilg/Workspace/Code/Rust/rust-gpu/crates/spirv-std/macros)
   Compiling walkdir v2.5.0
   Compiling document-features v0.2.10
   Compiling crossbeam-channel v0.5.13
   Compiling block2 v0.3.0
   Compiling hashbrown v0.11.2
   Compiling smallvec v1.13.2
error: failed to run custom build command for `rustc_codegen_spirv v0.9.0 (/Users/nilg/Workspace/Code/Rust/rust-gpu/crates/rustc_codegen_spirv)`

Caused by:
  process didn't exit successfully: `/Users/nilg/Workspace/Code/Rust/rust-gpu/target/debug/build/rustc_codegen_spirv-901cad1f3df6d18a/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=RUSTGPU_SKIP_TOOLCHAIN_CHECK

  --- stderr
  error: building from local source while `REQUIRED_RUST_TOOLCHAIN` (defined in `crates/rustc_codegen_spirv/build.rs`) doesn't match `/Users/nilg/Workspace/Code/Rust/rust-gpu/rust-toolchain.toml`
warning: build failed, waiting for other jobs to finish...

@nilanjan nilanjan added the bug Something isn't working label Dec 9, 2024
@LegNeato
Copy link
Collaborator

LegNeato commented Dec 9, 2024

Hmm, I am on the same OS version with a M1 Pro and can't repro. I get a different (known, #29) error which can be worked around with --release:

cargo run --release --bin example-runner-wgpu

@schell
Copy link
Contributor

schell commented Dec 9, 2024

I came here to say that it might be the --release error, but you beat me to it @LegNeato :)

Passing --release is worth a try @nilanjan 🤞

@nilanjan
Copy link
Author

nilanjan commented Dec 10, 2024

I have tried this with --release and still it fails with the same error.

   Compiling thiserror-impl v1.0.69
   Compiling rustc_codegen_spirv v0.9.0 (/Users/nilg/Workspace/Code/Rust/rust-gpu/crates/rustc_codegen_spirv)
   Compiling foreign-types v0.5.0
   Compiling metal v0.29.0
   Compiling derive_more v0.99.18
   Compiling spirv-std-macros v0.9.0 (/Users/nilg/Workspace/Code/Rust/rust-gpu/crates/spirv-std/macros)
error: failed to run custom build command for `rustc_codegen_spirv v0.9.0 (/Users/nilg/Workspace/Code/Rust/rust-gpu/crates/rustc_codegen_spirv)`

Caused by:
  process didn't exit successfully: `/Users/nilg/Workspace/Code/Rust/rust-gpu/target/release/build/rustc_codegen_spirv-a09c5ce28002f53d/build-script-build` (exit status: 1)
  --- stdout
  cargo:rerun-if-env-changed=RUSTGPU_SKIP_TOOLCHAIN_CHECK

  --- stderr
  error: building from local source while `REQUIRED_RUST_TOOLCHAIN` (defined in `crates/rustc_codegen_spirv/build.rs`) doesn't match `/Users/nilg/Workspace/Code/Rust/rust-gpu/rust-toolchain.toml`
warning: build failed, waiting for other jobs to finish...

@nilanjan
Copy link
Author

nilanjan commented Dec 10, 2024

Version details:

~/Workspace/Code/Rust/rust-gpu main*                                                                                                                                                                                                                    1m 31s py_venv 07:28:31 PM
❯ rustup toolchain list 
stable-aarch64-apple-darwin (default)
nightly-2024-04-24-aarch64-apple-darwin (override)

~/Workspace/Code/Rust/rust-gpu main*                                                                                                                                                                                                                           py_venv 07:30:34 PM
❯ rustc --version      
rustc 1.79.0-nightly (244da22fa 2024-04-23)

@eddyb
Copy link
Collaborator

eddyb commented Dec 18, 2024

(Just a minor GitHub style note: you need 3 backticks, i.e. ```, not just a single one, for multiline code blocks. I've also edited the existing comments for readability)

This is the error:

error: building from local source while REQUIRED_RUST_TOOLCHAIN (defined in crates/rustc_codegen_spirv/build.rs) doesn't match /Users/nilg/Workspace/Code/Rust/rust-gpu/rust-toolchain.toml

Maybe we should put it on multiple lines and/or use cargo::error to make this error more legible.

There is no crash at any point, so the OS or suggestions to use --release aren't relevant (or, well, they might be if you actually managed to build rustc_codegen_spirv).

I have no idea what state your code is in, but please make sure that crates/rustc_codegen_spirv/build.rs' const REQUIRED_RUST_TOOLCHAIN's contents are included in /Users/nilg/Workspace/Code/Rust/rust-gpu/rust-toolchain.toml.

On main these are:

const REQUIRED_RUST_TOOLCHAIN: &str = r#"[toolchain]
channel = "nightly-2024-04-24"
components = ["rust-src", "rustc-dev", "llvm-tools"]
# commit_hash = 244da22fabd9fa677bbd0ac601a88e5ca6917526"#;

[toolchain]
channel = "nightly-2024-04-24"
components = ["rust-src", "rustc-dev", "llvm-tools"]
# commit_hash = 244da22fabd9fa677bbd0ac601a88e5ca6917526

One or the other is likely changed locally for you, hence the error.

@eddyb eddyb changed the title Failed to build on MacOS Sequoia 15.1.1 (M1 Max) error: building from local source while REQUIRED_RUST_TOOLCHAIN doesn't match rust-toolchain.toml. Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants