mozilla / sccache

Sccache is a ccache-like tool. It is used as a compiler wrapper and avoids compilation when possible. Sccache has the capability to utilize caching in remote storage environments, including various cloud storage options, or alternatively, in local storage.
Apache License 2.0
5.82k stars 546 forks source link

can't boostrap if used for CXX/CC caching #422

Open matthiaskrgr opened 5 years ago

matthiaskrgr commented 5 years ago

I use sccache to cache CC and CXX invocations as well.

CC="sccache clang"
CXX="sccache clang++"

however with this, sccache fails to build itself!

The problem is that sccache requires rust-crypto 0.2.36, a package that has not been updated for 2.5 years and still uses the deprecated gcc crate (instead of cc)

Patching rustc-crypto to use cc is only a matter of a couple of lines

diff --git a/Cargo.toml b/Cargo.toml
index 8ea941a..ca3c58d 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,7 +17,7 @@ name = "crypto"
 with-bench = []

 [build-dependencies]
-gcc = "^0.3"
+cc = "*"

 [dependencies]
 libc = "^0.2"
diff --git a/build.rs b/build.rs
index 92dd2b6..85b5da0 100644
--- a/build.rs
+++ b/build.rs
@@ -4,7 +4,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.

-extern crate gcc;
+extern crate cc;

 use std::env;
 use std::path::Path;
@@ -13,7 +13,7 @@ fn main() {
     let target = env::var("TARGET").unwrap();
     let host = env::var("HOST").unwrap();
     if target.contains("msvc") && host.contains("windows") {
-        let mut config = gcc::Config::new();
+        let mut config = cc::Build::new();
         config.file("src/util_helpers.asm");
         config.file("src/aesni_helpers.asm");
         if target.contains("x86_64") {
@@ -22,7 +22,7 @@ fn main() {
         config.compile("lib_rust_crypto_helpers.a");
     }
     else {
-        let mut cfg = gcc::Config::new();
+        let mut cfg = cc::Build::new();
         cfg.file("src/util_helpers.c");
         cfg.file("src/aesni_helpers.c");
         if env::var_os("CC").is_none() {

however I'm not sure if this can be archived from sccaches Cargo.toml

TriplEight commented 5 years ago

I'd suggest moving to something which is actually better and being supported: https://github.com/RustCrypto

mati865 commented 5 years ago

cc https://github.com/mozilla/sccache/issues/330

luser commented 5 years ago

310 has a patch to switch everything to RustCrypto. Someone would need to make the decision and then review and land that patch. (I'm no longer actively maintaining sccache.)