Skip to content

Commit 4c7c89c

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 9b2522b commit 4c7c89c

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

crates/rustc_codegen_nvvm/build.rs

Lines changed: 13 additions & 2 deletions
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());
@@ -44,7 +44,11 @@ fn llvm19_enabled() -> bool {
4444
}
4545

4646
fn required_major_llvm_version(llvm19_enabled: bool) -> u8 {
47-
if llvm19_enabled { 19 } else { 7 }
47+
if llvm19_enabled {
48+
19
49+
} else {
50+
7
51+
}
4852
}
4953

5054
fn command_version(path: &Path) -> Option<String> {
@@ -181,6 +185,13 @@ fn find_llvm_config_llvm7(target: &str) -> PathBuf {
181185
.expect("Failed to download prebuilt LLVM");
182186
}
183187

188+
let response_code = easy.response_code().unwrap();
189+
if response_code != 200 {
190+
fail(&format!(
191+
"Failed to download prebuilt LLVM from {url}. HTTP response code: {response_code}"
192+
));
193+
}
194+
184195
let decompressor = XzDecoder::new(xz_encoded.as_slice());
185196
let mut ar = Archive::new(decompressor);
186197

0 commit comments

Comments
 (0)