-
Notifications
You must be signed in to change notification settings - Fork 85
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Expected Behaviour
cargo compiletest -> 0 not -> 1
Example & Steps To Reproduce
-
Be on Windows 11.
-
git clone ...rust-gpu --recurse-submods yada yada
3. cargo compiletest (alias set in .cargo/config.toml)
Produces this error:
> cargo compiletest
Compiling compiletest_rs v0.9.0
error: environment variable `HOST` not defined at compile time
--> C:\Users\jer\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiletest_rs-0.9.0\src\common.rs:397:19
|
397 | host: env!("HOST").to_string(),
| ^^^^^^^^^^^^
|
= help: Cargo sets build script variables at run time. Use `std::env::var("HOST")` instead
= note: this error originates in the macro `env` (in Nightly builds, run with -Z macro-backtrace for more info)
error: could not compile `compiletest_rs` (lib) due to 1 previous errorthe offending code in compiletest-rs is:
...
#[cfg(not(feature = "rustc"))]
host: env!("HOST").to_string(),
...So for some reason we're not supplying a target triple any longer?
If we manually inject a triple from the into compiletest like so:
// ~\.cargo\registry\src\index.crates.io-6f17d22bba15001f\compiletest_rs-0.9.0\src\common.rs:397:19
#[cfg(not(feature = "rustc"))]
host: "x86_64-pc-windows-msvc".to_string(),then we get the expected output:
running 231 tests
test [ui] ui\arch\debug_printf_type_checking.rs ... ok
test [ui] ui\arch\all_memory_barrier_with_group_sync.rs ... ok
test [ui] ui\arch\demote_to_helper_invocation.rs ... ok
test [ui] ui\arch\any.rs ... ok
test [ui] ui\arch\atomic_i_increment.rs ... ok
test [ui] ui\arch\convert_u_to_acceleration_structure_khr.rs ... ok
test [ui] ui\arch\derivative_control.rs ... ok
test [ui] ui\arch\emit_stream_vertex.rs ... ok
test [ui] ui\arch\derivative.rs ... ok
test [ui] ui\arch\all.rs ... ok
test [ui] ui\arch\mesh_shader_output_lines.rs ... ignored
... and so onSo, the question is why is the triple not being set (for Windows only?)?
If there's an idea about where to inject the $HOST maybe, for example it could be in the rustc_codegen_spirv's build.rs ?
Something like:
println!("cargo::warning=");
let host_triple = "x86_64-pc-windows-msvc"; // obviously not hardcoding it, but ensuring cargo has it.
// Set HOST for compile-time use (env!("HOST"))
println!("cargo:rustc-env=HOST={}", host_triple);Happy to fix it if maybe @eddyb or @Firestar99 can tell me where to go digging?
System Info
- Rust: rustc 1.84.0-nightly (b19329a37 2024-11-21)
binary: rustc
commit-hash: b19329a37cedf2027517ae22c87cf201f93d776e
commit-date: 2024-11-21
host: x86_64-pc-windows-msvc
release: 1.84.0-nightly
LLVM version: 19.1.4 - OS: OS: Windows 11 Pro x86_64
Host: X570 AORUS ELITE WIFI (-CF)
Kernel: WIN32_NT 10.0.22631.5189 (23H2) - GPU: NVIDIA TITAN RTX (23.69 GiB) [Discrete]
- SPIR-V: SPIRV-Tools v2023.3 v2022.4-198-ge7c6084f
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working