Skip to content

Commit ed7272a

Browse files
committed
fix(nvvm): fix broken LLVM 7 download URL in build.rs
The tag name on GitHub was lowercase 'llvm-7.1.0', but the URL was hardcoded to use uppercase 'LLVM-7.1.0', which has no release assets. Also added an explicit HTTP response code check to catch download failures early with a descriptive error message instead of failing later with an 'UnexpectedEof' during archive unpacking.
1 parent 103a8d5 commit ed7272a

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

crates/rustc_codegen_nvvm/build.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use tar::Archive;
1111
use xz::read::XzDecoder;
1212

1313
static PREBUILT_LLVM_URL_LLVM7: &str =
14-
"https://github.com/rust-gpu/rustc_codegen_nvvm-llvm/releases/download/LLVM-7.1.0/";
14+
"https://github.com/rust-gpu/rustc_codegen_nvvm-llvm/releases/download/llvm-7.1.0/";
1515

1616
fn main() {
1717
rustc_llvm_build(llvm19_enabled());
@@ -181,6 +181,13 @@ fn find_llvm_config_llvm7(target: &str) -> PathBuf {
181181
.expect("Failed to download prebuilt LLVM");
182182
}
183183

184+
let response_code = easy.response_code().unwrap();
185+
if response_code != 200 {
186+
fail(&format!(
187+
"Failed to download prebuilt LLVM from {url}. HTTP response code: {response_code}"
188+
));
189+
}
190+
184191
let decompressor = XzDecoder::new(xz_encoded.as_slice());
185192
let mut ar = Archive::new(decompressor);
186193

@@ -320,6 +327,12 @@ fn rustc_llvm_build(llvm19_enabled: bool) {
320327
if flag.starts_with("-flto") {
321328
continue;
322329
}
330+
331+
// if we are on msvc, ignore all -W flags as msvc uses /W and -W is invalid.
332+
if target.contains("msvc") && flag.starts_with("-W") {
333+
continue;
334+
}
335+
323336
// ignore flags that aren't supported in gcc 8
324337
if flag == "-Wcovered-switch-default" {
325338
continue;

0 commit comments

Comments
 (0)