From 4d4a75ff49e311086379731229bf51b75eec08ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Fri, 31 May 2024 19:22:42 +0200 Subject: [PATCH 1/5] update the download url - the gcc repository fork has moved to by under the rust-lang org --- build_system/src/config.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 041d75915fb..0c28ebef0ef 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -232,7 +232,7 @@ impl ConfigInfo { let is_in_ci = std::env::var("GITHUB_ACTIONS").is_ok(); let url = format!( - "https://github.com/antoyo/gcc/releases/download/master-{}/libgccjit.so", + "https://github.com/rust-lang/gcc/releases/download/master-{}/libgccjit.so", commit, ); From 6d89384c742a306b3ca36d3ba37c1bdd4ad0a6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Fri, 31 May 2024 19:39:50 +0200 Subject: [PATCH 2/5] error if we attempt to download libggcjit.so on an unsupported os or arch --- build_system/src/config.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 0c28ebef0ef..3cb03794719 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -474,6 +474,19 @@ fn download_gccjit( tempfile_name: String, with_progress_bar: bool, ) -> Result<(), String> { + if std::env::consts::OS != "linux" || std::env::consts::ARCH != "x86_64" { + eprintln!( + "\ + pre-compiled libgccjit.so not available for this os or architecture\n\ + please compile it yourself and in the config.toml set\n\ + `download-gccjit = false` and `gcc-path` to the appropriate directory\ + " + ); + return Err(String::from( + "no appropriate pre-compiled libgccjit.so available for download", + )); + } + // Try curl. If that fails and we are on windows, fallback to PowerShell. let mut ret = run_command_with_output( &[ From 4886265f7cde7c2c9de49a690578c6fe5eb2f3a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Fri, 31 May 2024 19:47:23 +0200 Subject: [PATCH 3/5] move the download url construction to download_gccjit --- build_system/src/config.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 3cb03794719..4f9b4dab138 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/rust-lang/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,12 +463,14 @@ impl ConfigInfo { } fn download_gccjit( - url: String, + commit: &str, output_dir: &Path, tempfile_name: String, with_progress_bar: bool, ) -> Result<(), String> { - if std::env::consts::OS != "linux" || std::env::consts::ARCH != "x86_64" { + 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\n\ @@ -485,7 +481,9 @@ fn download_gccjit( 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( From c4e3a2951927e1d542925c4429cf046d31345fef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bennet=20Ble=C3=9Fmann?= Date: Sat, 1 Jun 2024 11:41:19 +0200 Subject: [PATCH 4/5] apply suggestion by GuillaumeGomez Co-authored-by: Guillaume Gomez --- build_system/src/config.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 4f9b4dab138..7d1968eb390 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -473,9 +473,9 @@ fn download_gccjit( } else { eprintln!( "\ - pre-compiled libgccjit.so not available for this os or architecture\n\ - please compile it yourself and in the config.toml set\n\ - `download-gccjit = false` and `gcc-path` to the appropriate directory\ + Pre-compiled libgccjit.so not available for this os or architecture.\n\ + Please compile it yourself and update the `config.toml` file\n\ + to `download-gccjit = false` and set `gcc-path` to the appropriate directory.\ " ); return Err(String::from( From 7e6b25e653ef406ff4fcccf5f3e0eec02e4d7774 Mon Sep 17 00:00:00 2001 From: Skgland Date: Sat, 1 Jun 2024 12:23:36 +0200 Subject: [PATCH 5/5] apply suggestion by GuillaumeGomez Co-authored-by: Guillaume Gomez --- build_system/src/config.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build_system/src/config.rs b/build_system/src/config.rs index 7d1968eb390..081e7d2e250 100644 --- a/build_system/src/config.rs +++ b/build_system/src/config.rs @@ -473,10 +473,9 @@ fn download_gccjit( } else { eprintln!( "\ - Pre-compiled libgccjit.so not available for this os or architecture.\n\ - Please compile it yourself and update the `config.toml` file\n\ - to `download-gccjit = false` and set `gcc-path` to the appropriate directory.\ - " +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",