diff options
| author | Bennet Bleßmann <bennet.blessmann+github@googlemail.com> | 2024-06-01 13:29:55 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-01 13:29:55 +0200 |
| commit | eccab8ba39e9c5a3dfcf146105909039b64b0577 (patch) | |
| tree | 0d87a983d452475dfbd7c25d60732b7652225650 | |
| parent | c2c93ee721d5a2a77045ebca4810bf2e94d64f76 (diff) | |
| download | rust-eccab8ba39e9c5a3dfcf146105909039b64b0577.tar.gz rust-eccab8ba39e9c5a3dfcf146105909039b64b0577.zip | |
prevent libgccjit.so download on unsupported os/arch (#529)
prevent libgccjit.so download on unsupported os/arch (#529) Co-authored-by: Guillaume Gomez <guillaume1.gomez@gmail.com>
| -rw-r--r-- | build_system/src/config.rs | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 041d75915fb..081e7d2e250 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -231,13 +231,7 @@ impl ConfigInfo { let tempfile = output_dir.join(&tempfile_name); let is_in_ci = std::env::var("GITHUB_ACTIONS").is_ok(); - let url = format!( - "https://github.com/antoyo/gcc/releases/download/master-{}/libgccjit.so", - commit, - ); - - println!("Downloading `{}`...", url); - download_gccjit(url, &output_dir, tempfile_name, !is_in_ci)?; + download_gccjit(&commit, &output_dir, tempfile_name, !is_in_ci)?; let libgccjit_so = output_dir.join(libgccjit_so_name); // If we reach this point, it means the file was correctly downloaded, so let's @@ -469,11 +463,27 @@ impl ConfigInfo { } fn download_gccjit( - url: String, + commit: &str, output_dir: &Path, tempfile_name: String, with_progress_bar: bool, ) -> Result<(), String> { + let url = if std::env::consts::OS == "linux" && std::env::consts::ARCH == "x86_64" { + format!("https://github.com/rust-lang/gcc/releases/download/master-{}/libgccjit.so", commit) + } else { + eprintln!( + "\ +Pre-compiled libgccjit.so not available for this os or architecture. +Please compile it yourself and update the `config.toml` file +to `download-gccjit = false` and set `gcc-path` to the appropriate directory." + ); + return Err(String::from( + "no appropriate pre-compiled libgccjit.so available for download", + )); + }; + + println!("Downloading `{}`...", url); + // Try curl. If that fails and we are on windows, fallback to PowerShell. let mut ret = run_command_with_output( &[ |
