From 12d84cc0096c60573b8c0d7f14da8fa904e326b6 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Sep 2017 10:54:43 +0200 Subject: [PATCH 1/2] update gcc crate Use gcc::Build rather than deprecated gcc::Config. Fixes #43973 --- src/Cargo.lock | 36 ++++++++++++++-------------- src/bootstrap/bin/sccache-plus-cl.rs | 2 +- src/bootstrap/cc.rs | 6 ++--- src/bootstrap/native.rs | 2 +- src/liballoc_jemalloc/build.rs | 4 ++-- src/libprofiler_builtins/build.rs | 2 +- src/librustc_llvm/build.rs | 2 +- src/librustdoc/build.rs | 2 +- src/libstd/build.rs | 2 +- 9 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/Cargo.lock b/src/Cargo.lock index 4842555bca6ae..afc61643eaa5e 100644 --- a/src/Cargo.lock +++ b/src/Cargo.lock @@ -47,7 +47,7 @@ dependencies = [ "alloc_system 0.0.0", "build_helper 0.1.0", "core 0.0.0", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.0.0", ] @@ -103,7 +103,7 @@ name = "backtrace-sys" version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -137,7 +137,7 @@ dependencies = [ "build_helper 0.1.0", "cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -270,7 +270,7 @@ name = "cmake" version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -286,7 +286,7 @@ name = "compiler_builtins" version = "0.0.0" dependencies = [ "core 0.0.0", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -397,7 +397,7 @@ name = "curl-sys" version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -577,7 +577,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "gcc" -version = "0.3.51" +version = "0.3.53" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -837,7 +837,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cmake 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", "curl-sys 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "libssh2-sys 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -862,7 +862,7 @@ name = "libz-sys" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -883,7 +883,7 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -965,7 +965,7 @@ name = "miniz-sys" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1101,7 +1101,7 @@ name = "openssl-sys" version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1206,7 +1206,7 @@ name = "profiler_builtins" version = "0.0.0" dependencies = [ "core 0.0.0", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1598,7 +1598,7 @@ name = "rustc_llvm" version = "0.0.0" dependencies = [ "build_helper 0.1.0", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_bitflags 0.0.0", ] @@ -1728,7 +1728,7 @@ name = "rustc_trans" version = "0.0.0" dependencies = [ "flate2 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "jobserver 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1793,7 +1793,7 @@ version = "0.0.0" dependencies = [ "build_helper 0.1.0", "env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "html-diff 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", "pulldown-cmark 0.0.14 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1966,7 +1966,7 @@ dependencies = [ "collections 0.0.0", "compiler_builtins 0.0.0", "core 0.0.0", - "gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.0.0", "panic_abort 0.0.0", "panic_unwind 0.0.0", @@ -2470,7 +2470,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum fs2 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9ab76cfd2aaa59b7bf6688ad9ba15bbae64bff97f04ea02144cfd3443e5c2866" "checksum futf 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "51f93f3de6ba1794dcd5810b3546d004600a59a98266487c8407bc4b24e398f3" "checksum futures 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)" = "a82bdc62350ca9d7974c760e9665102fc9d740992a528c2254aa930e53b783c4" -"checksum gcc 0.3.51 (registry+https://github.com/rust-lang/crates.io-index)" = "120d07f202dcc3f72859422563522b66fe6463a4c513df062874daad05f85f0a" +"checksum gcc 0.3.53 (registry+https://github.com/rust-lang/crates.io-index)" = "e8310f7e9c890398b0e80e301c4f474e9918d2b27fca8f48486ca775fa9ffc5a" "checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685" "checksum git2 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "0c1c0203d653f4140241da0c1375a404f0a397249ec818cd2076c6280c50f6fa" "checksum git2-curl 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "68676bc784bf0bef83278898929bf64a251e87c0340723d0b93fa096c9c5bf8e" diff --git a/src/bootstrap/bin/sccache-plus-cl.rs b/src/bootstrap/bin/sccache-plus-cl.rs index cf0c12749234c..5684a565a9c0e 100644 --- a/src/bootstrap/bin/sccache-plus-cl.rs +++ b/src/bootstrap/bin/sccache-plus-cl.rs @@ -18,7 +18,7 @@ fn main() { // Locate the actual compiler that we're invoking env::remove_var("CC"); env::remove_var("CXX"); - let mut cfg = gcc::Config::new(); + let mut cfg = gcc::Build::new(); cfg.cargo_metadata(false) .out_dir("/") .target(&target) diff --git a/src/bootstrap/cc.rs b/src/bootstrap/cc.rs index 0f25da8a238d0..2541950d6c75e 100644 --- a/src/bootstrap/cc.rs +++ b/src/bootstrap/cc.rs @@ -45,7 +45,7 @@ pub fn find(build: &mut Build) { // For all targets we're going to need a C compiler for building some shims // and such as well as for being a linker for Rust code. for target in build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build)) { - let mut cfg = gcc::Config::new(); + let mut cfg = gcc::Build::new(); cfg.cargo_metadata(false).opt_level(0).debug(false) .target(&target).host(&build.build); @@ -67,7 +67,7 @@ pub fn find(build: &mut Build) { // For all host triples we need to find a C++ compiler as well for host in build.hosts.iter().cloned().chain(iter::once(build.build)) { - let mut cfg = gcc::Config::new(); + let mut cfg = gcc::Build::new(); cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true) .target(&host).host(&build.build); let config = build.config.target_config.get(&host); @@ -82,7 +82,7 @@ pub fn find(build: &mut Build) { } } -fn set_compiler(cfg: &mut gcc::Config, +fn set_compiler(cfg: &mut gcc::Build, gnu_compiler: &str, target: Interned, config: Option<&Target>, diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 8173903c03440..0d1bcabc7452e 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -289,7 +289,7 @@ impl Step for TestHelpers { let _folder = build.fold_output(|| "build_test_helpers"); println!("Building test helpers"); t!(fs::create_dir_all(&dst)); - let mut cfg = gcc::Config::new(); + let mut cfg = gcc::Build::new(); // We may have found various cross-compilers a little differently due to our // extra configuration, so inform gcc of these compilers. Note, though, that diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index c9bea2ecf5e9f..1864df4477abf 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -63,7 +63,7 @@ fn main() { _ => return, }; - let compiler = gcc::Config::new().get_compiler(); + let compiler = gcc::Build::new().get_compiler(); // only msvc returns None for ar so unwrap is okay let ar = build_helper::cc2ar(compiler.path(), &target).unwrap(); let cflags = compiler.args() @@ -150,7 +150,7 @@ fn main() { // sure the symbols are available. if target.contains("androideabi") { println!("cargo:rerun-if-changed=pthread_atfork_dummy.c"); - gcc::Config::new() + gcc::Build::new() .flag("-fvisibility=hidden") .file("pthread_atfork_dummy.c") .compile("libpthread_atfork_dummy.a"); diff --git a/src/libprofiler_builtins/build.rs b/src/libprofiler_builtins/build.rs index 55df14ea2150a..41e92b33475da 100644 --- a/src/libprofiler_builtins/build.rs +++ b/src/libprofiler_builtins/build.rs @@ -19,7 +19,7 @@ use std::path::Path; fn main() { let target = env::var("TARGET").expect("TARGET was not set"); - let cfg = &mut gcc::Config::new(); + let cfg = &mut gcc::Build::new(); let mut profile_sources = vec!["GCDAProfiling.c", "InstrProfiling.c", diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 3f0f5369607e5..9aa4ff1aefcc7 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -136,7 +136,7 @@ fn main() { let mut cmd = Command::new(&llvm_config); cmd.arg("--cxxflags"); let cxxflags = output(&mut cmd); - let mut cfg = gcc::Config::new(); + let mut cfg = gcc::Build::new(); for flag in cxxflags.split_whitespace() { // Ignore flags like `-m64` when we're doing a cross build if is_crossed && flag.starts_with("-m") { diff --git a/src/librustdoc/build.rs b/src/librustdoc/build.rs index 4189e3d2ac707..130c6fd01a8d8 100644 --- a/src/librustdoc/build.rs +++ b/src/librustdoc/build.rs @@ -14,7 +14,7 @@ extern crate gcc; fn main() { let src_dir = std::path::Path::new("../rt/hoedown/src"); build_helper::rerun_if_changed_anything_in_dir(src_dir); - let mut cfg = gcc::Config::new(); + let mut cfg = gcc::Build::new(); cfg.file("../rt/hoedown/src/autolink.c") .file("../rt/hoedown/src/buffer.c") .file("../rt/hoedown/src/document.c") diff --git a/src/libstd/build.rs b/src/libstd/build.rs index f57dec98b795b..7dec7eb77e1b9 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -77,7 +77,7 @@ fn main() { fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> { let native = native_lib_boilerplate("libbacktrace", "libbacktrace", "backtrace", ".libs")?; - let compiler = gcc::Config::new().get_compiler(); + let compiler = gcc::Build::new().get_compiler(); // only msvc returns None for ar so unwrap is okay let ar = build_helper::cc2ar(compiler.path(), target).unwrap(); let mut cflags = compiler.args().iter().map(|s| s.to_str().unwrap()) From 13cf2290371eba6d91670355e0b82fc3b15b920a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 5 Sep 2017 17:48:47 +0200 Subject: [PATCH 2/2] disable gcc warnings --- src/bootstrap/bin/sccache-plus-cl.rs | 1 + src/bootstrap/cc.rs | 4 ++-- src/bootstrap/native.rs | 1 + src/librustc_llvm/build.rs | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/bin/sccache-plus-cl.rs b/src/bootstrap/bin/sccache-plus-cl.rs index 5684a565a9c0e..266dffa5c92c7 100644 --- a/src/bootstrap/bin/sccache-plus-cl.rs +++ b/src/bootstrap/bin/sccache-plus-cl.rs @@ -24,6 +24,7 @@ fn main() { .target(&target) .host(&target) .opt_level(0) + .warnings(false) .debug(false); let compiler = cfg.get_compiler(); diff --git a/src/bootstrap/cc.rs b/src/bootstrap/cc.rs index 2541950d6c75e..c77e609d70be0 100644 --- a/src/bootstrap/cc.rs +++ b/src/bootstrap/cc.rs @@ -46,7 +46,7 @@ pub fn find(build: &mut Build) { // and such as well as for being a linker for Rust code. for target in build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build)) { let mut cfg = gcc::Build::new(); - cfg.cargo_metadata(false).opt_level(0).debug(false) + cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false) .target(&target).host(&build.build); let config = build.config.target_config.get(&target); @@ -68,7 +68,7 @@ pub fn find(build: &mut Build) { // For all host triples we need to find a C++ compiler as well for host in build.hosts.iter().cloned().chain(iter::once(build.build)) { let mut cfg = gcc::Build::new(); - cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true) + cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false).cpp(true) .target(&host).host(&build.build); let config = build.config.target_config.get(&host); if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) { diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 0d1bcabc7452e..d9dc9df823a56 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -306,6 +306,7 @@ impl Step for TestHelpers { .target(&target) .host(&build.build) .opt_level(0) + .warnings(false) .debug(false) .file(build.src.join("src/rt/rust_test_helpers.c")) .compile("librust_test_helpers.a"); diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 9aa4ff1aefcc7..393aa7fa43bab 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -137,6 +137,7 @@ fn main() { cmd.arg("--cxxflags"); let cxxflags = output(&mut cmd); let mut cfg = gcc::Build::new(); + cfg.warnings(false); for flag in cxxflags.split_whitespace() { // Ignore flags like `-m64` when we're doing a cross build if is_crossed && flag.starts_with("-m") {