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>
This commit is contained in:
parent
c2c93ee721
commit
eccab8ba39
@ -231,13 +231,7 @@ fn download_gccjit_if_needed(&mut self) -> Result<(), String> {
|
||||
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 @@ pub fn show_usage() {
|
||||
}
|
||||
|
||||
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(
|
||||
&[
|
||||
|
Loading…
Reference in New Issue
Block a user