diff --git a/pkgs/applications/networking/browsers/firefox/common.nix b/pkgs/applications/networking/browsers/firefox/common.nix index 71af81eb1bd21..65cef3da96874 100644 --- a/pkgs/applications/networking/browsers/firefox/common.nix +++ b/pkgs/applications/networking/browsers/firefox/common.nix @@ -10,7 +10,7 @@ , hunspell, libevent, libstartup_notification, libvpx , icu, libpng, jemalloc, glib , autoconf213, which, gnused, cargo, rustc, llvmPackages -, rust-cbindgen, rust-cbindgen_0_6_7, nodejs, rust_1_29 +, rust-cbindgen, rust-cbindgen_0_6_7, nodejs, rust_1_31 , debugBuild ? false ### optionals @@ -127,7 +127,7 @@ stdenv.mkDerivation (rec { nativeBuildInputs = [ autoconf213 which gnused pkgconfig perl python2 ] ++ (if (lib.versionAtLeast version "63") then [ - nodejs rust_1_29.rustc rust_1_29.cargo + nodejs rust_1_31.rustc rust_1_31.cargo ] else [ cargo rustc ]) ++ (if (lib.versionAtLeast version "64") then [ rust-cbindgen_0_6_7 diff --git a/pkgs/development/compilers/rust/1.29/binaryBuild.nix b/pkgs/development/compilers/rust/1.31/binaryBuild.nix similarity index 97% rename from pkgs/development/compilers/rust/1.29/binaryBuild.nix rename to pkgs/development/compilers/rust/1.31/binaryBuild.nix index 488d43a6fea4f..77dba7f9e620e 100644 --- a/pkgs/development/compilers/rust/1.29/binaryBuild.nix +++ b/pkgs/development/compilers/rust/1.31/binaryBuild.nix @@ -1,4 +1,4 @@ -{ stdenv, makeWrapper, bash, buildRustPackage, curl, darwin +{ stdenv, makeWrapper, bash, curl, darwin , version , src , platform @@ -18,8 +18,6 @@ let in rec { - inherit buildRustPackage; - rustc = stdenv.mkDerivation rec { name = "rustc-${versionType}-${version}"; diff --git a/pkgs/development/compilers/rust/1.29/bootstrap.nix b/pkgs/development/compilers/rust/1.31/bootstrap.nix similarity index 59% rename from pkgs/development/compilers/rust/1.29/bootstrap.nix rename to pkgs/development/compilers/rust/1.31/bootstrap.nix index 55348c5795ad4..9528d798618f6 100644 --- a/pkgs/development/compilers/rust/1.29/bootstrap.nix +++ b/pkgs/development/compilers/rust/1.31/bootstrap.nix @@ -3,16 +3,16 @@ let # Note: the version MUST be one version prior to the version we're # building - version = "1.28.0"; + version = "1.30.1"; - # fetch hashes by running `print-hashes.sh 1.24.1` + # fetch hashes by running `print-hashes.sh 1.30.0` hashes = { - i686-unknown-linux-gnu = "de7cdb4e665e897ea9b10bf6fd545f900683296456d6a11d8510397bb330455f"; - x86_64-unknown-linux-gnu = "2a1390340db1d24a9498036884e6b2748e9b4b057fc5219694e298bdaa37b810"; - armv7-unknown-linux-gnueabihf = "346558d14050853b87049e5e1fbfae0bf0360a2f7c57433c6985b1a879c349a2"; - aarch64-unknown-linux-gnu = "9b6fbcee73070332c811c0ddff399fa31965bec62ef258656c0c90354f6231c1"; - i686-apple-darwin = "752e2c9182e057c4a54152d1e0b3949482c225d02bb69d9d9a4127dc2a65fb68"; - x86_64-apple-darwin = "5d7a70ed4701fe9410041c1eea025c95cad97e5b3d8acc46426f9ac4f9f02393"; + i686-unknown-linux-gnu = "c61655977fb16decf0ceb76043b9ae2190927aa9cc24f013d444384dcab99bbf"; + x86_64-unknown-linux-gnu = "a01a493ed8946fc1c15f63e74fc53299b26ebf705938b4d04a388a746dfdbf9e"; + armv7-unknown-linux-gnueabihf = "9b3b6df02a2a92757e4993a7357fdd02e07b60101a748b4618e6ae1b90bc1b6b"; + aarch64-unknown-linux-gnu = "6d87d81561285abd6c1987e07b60b2d723936f037c4b46eedcc12e8566fd3874"; + i686-apple-darwin = "a7c14b18e96406d9f43d69d0f984b2fa6f92cc7b7b37e2bb7b70b6f44b02b083"; + x86_64-apple-darwin = "3ba1704a7defe3d9a6f0c1f68792c084da83bcba85e936d597bac0c019914b94"; }; platform = @@ -37,6 +37,5 @@ let in callPackage ./binaryBuild.nix { inherit version src platform; - buildRustPackage = null; versionType = "bootstrap"; } diff --git a/pkgs/development/compilers/rust/1.29/cargo.nix b/pkgs/development/compilers/rust/1.31/cargo.nix similarity index 91% rename from pkgs/development/compilers/rust/1.29/cargo.nix rename to pkgs/development/compilers/rust/1.31/cargo.nix index 25a71965e0b49..02ea7ebbbfbfe 100644 --- a/pkgs/development/compilers/rust/1.29/cargo.nix +++ b/pkgs/development/compilers/rust/1.31/cargo.nix @@ -1,13 +1,10 @@ { stdenv, file, curl, pkgconfig, python, openssl, cmake, zlib -, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2, darwin +, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2 +, CoreFoundation, Security , version , patches ? [] , src }: -let - inherit (darwin.apple_sdk.frameworks) CoreFoundation; -in - rustPlatform.buildRustPackage rec { name = "cargo-${version}"; inherit version src patches; @@ -24,7 +21,7 @@ rustPlatform.buildRustPackage rec { nativeBuildInputs = [ pkgconfig ]; buildInputs = [ cacert file curl python openssl cmake zlib makeWrapper libgit2 ] - ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation libiconv ]; + ++ stdenv.lib.optionals stdenv.isDarwin [ CoreFoundation Security libiconv ]; LIBGIT2_SYS_USE_PKG_CONFIG=1; diff --git a/pkgs/development/compilers/rust/1.29/default.nix b/pkgs/development/compilers/rust/1.31/default.nix similarity index 87% rename from pkgs/development/compilers/rust/1.29/default.nix rename to pkgs/development/compilers/rust/1.31/default.nix index 7d785093f9b30..1f24157eea426 100644 --- a/pkgs/development/compilers/rust/1.29/default.nix +++ b/pkgs/development/compilers/rust/1.31/default.nix @@ -1,4 +1,5 @@ { stdenv, callPackage, recurseIntoAttrs, makeRustPlatform, llvm, fetchurl +, CoreFoundation, Security , targets ? [] , targetToolchains ? [] , targetPatches ? [] @@ -6,11 +7,11 @@ let rustPlatform = recurseIntoAttrs (makeRustPlatform (callPackage ./bootstrap.nix {})); - version = "1.29.1"; - cargoVersion = "1.29.1"; + version = "1.31.0"; + cargoVersion = "1.31.0"; src = fetchurl { url = "https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"; - sha256 = "0jd3c57x3yndizns4pb68nh25si47agfmrdvf9nwwsyfcs5p5c7i"; + sha256 = "01pg2619bwjnhjbphryrbkwaz0lw8cfffm4xlz35znzipb04vmcs"; }; in rec { rustc = callPackage ./rustc.nix { @@ -28,7 +29,7 @@ in rec { ./patches/disable-test-inherit-env.patch ]; - forceBundledLLVM = true; + withBundledLLVM = false; configureFlags = [ "--release-channel=stable" ]; @@ -44,8 +45,7 @@ in rec { cargo = callPackage ./cargo.nix rec { version = cargoVersion; - inherit src; - inherit stdenv; + inherit src stdenv CoreFoundation Security; inherit rustc; # the rustc that will be wrapped by cargo inherit rustPlatform; # used to build cargo }; diff --git a/pkgs/development/compilers/rust/1.29/patches/disable-test-inherit-env.patch b/pkgs/development/compilers/rust/1.31/patches/disable-test-inherit-env.patch similarity index 100% rename from pkgs/development/compilers/rust/1.29/patches/disable-test-inherit-env.patch rename to pkgs/development/compilers/rust/1.31/patches/disable-test-inherit-env.patch diff --git a/pkgs/development/compilers/rust/1.29/patches/net-tcp-disable-tests.patch b/pkgs/development/compilers/rust/1.31/patches/net-tcp-disable-tests.patch similarity index 100% rename from pkgs/development/compilers/rust/1.29/patches/net-tcp-disable-tests.patch rename to pkgs/development/compilers/rust/1.31/patches/net-tcp-disable-tests.patch diff --git a/pkgs/development/compilers/rust/1.29/patches/stdsimd-disable-doctest.patch b/pkgs/development/compilers/rust/1.31/patches/stdsimd-disable-doctest.patch similarity index 100% rename from pkgs/development/compilers/rust/1.29/patches/stdsimd-disable-doctest.patch rename to pkgs/development/compilers/rust/1.31/patches/stdsimd-disable-doctest.patch diff --git a/pkgs/development/compilers/rust/1.31/print-hashes.sh b/pkgs/development/compilers/rust/1.31/print-hashes.sh new file mode 100755 index 0000000000000..7eb00a30ad73f --- /dev/null +++ b/pkgs/development/compilers/rust/1.31/print-hashes.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -euo pipefail + +# All rust-related downloads can be found at +# https://static.rust-lang.org/dist/index.html. To find the date on +# which a particular thing was last updated, look for the *-date.txt +# file, e.g. +# https://static.rust-lang.org/dist/channel-rust-beta-date.txt + +PLATFORMS=( + i686-unknown-linux-gnu + x86_64-unknown-linux-gnu + armv7-unknown-linux-gnueabihf + aarch64-unknown-linux-gnu + i686-apple-darwin + x86_64-apple-darwin +) +BASEURL=https://static.rust-lang.org/dist +VERSION=${1:-} +DATE=${2:-} + +if [[ -z $VERSION ]] +then + echo "No version supplied" + exit -1 +fi + +if [[ -n $DATE ]] +then + BASEURL=$BASEURL/$DATE +fi + +for PLATFORM in "${PLATFORMS[@]}" +do + URL="$BASEURL/rust-$VERSION-$PLATFORM.tar.gz.sha256" + SHA256=$(curl -sSfL $URL | cut -d ' ' -f 1) + echo "$PLATFORM = \"$SHA256\";" +done diff --git a/pkgs/development/compilers/rust/1.31/rust-src.nix b/pkgs/development/compilers/rust/1.31/rust-src.nix new file mode 100644 index 0000000000000..1b819a7f60682 --- /dev/null +++ b/pkgs/development/compilers/rust/1.31/rust-src.nix @@ -0,0 +1,11 @@ +{ stdenv, rustc }: + +stdenv.mkDerivation { + name = "rust-src"; + src = rustc.src; + phases = [ "unpackPhase" "installPhase" ]; + installPhase = '' + mv src $out + rm -rf $out/{ci,doc,driver,etc,grammar,llvm,rt,rtstartup,rustllvm,test,tools,vendor} + ''; +} diff --git a/pkgs/development/compilers/rust/1.29/rustc.nix b/pkgs/development/compilers/rust/1.31/rustc.nix similarity index 71% rename from pkgs/development/compilers/rust/1.29/rustc.nix rename to pkgs/development/compilers/rust/1.31/rustc.nix index 40e3c6ce01f69..3ec08a82d0179 100644 --- a/pkgs/development/compilers/rust/1.29/rustc.nix +++ b/pkgs/development/compilers/rust/1.31/rustc.nix @@ -1,9 +1,9 @@ -{ stdenv, targetPackages -, fetchurl, fetchgit, fetchzip, file, python2, tzdata, procps +{ stdenv, targetPackages, removeReferencesTo +, fetchurl, fetchgit, fetchzip, file, python2, tzdata, ps , llvm, jemalloc, ncurses, darwin, rustPlatform, git, cmake, curl , which, libffi, gdb , version -, forceBundledLLVM ? false +, withBundledLLVM ? false , src , configureFlags ? [] , patches @@ -20,6 +20,8 @@ let llvmShared = llvm.override { enableSharedLibraries = true; }; + prefixedJemalloc = jemalloc.override { stripPrefix = false; }; + target = builtins.replaceStrings [" "] [","] (builtins.toString targets); in @@ -40,7 +42,11 @@ stdenv.mkDerivation { # See https://github.com/NixOS/nixpkgs/pull/34227 stripDebugList = if stdenv.isDarwin then [ "bin" ] else null; - NIX_LDFLAGS = optionalString stdenv.isDarwin "-rpath ${llvmShared}/lib"; + NIX_LDFLAGS = + # when linking stage1 libstd: cc: undefined reference to `__cxa_begin_catch' + optional (stdenv.isLinux && !withBundledLLVM) "--push-state --as-needed -lstdc++ --pop-state" + ++ optional (stdenv.isDarwin && !withBundledLLVM) "-lc++" + ++ optional stdenv.isDarwin "-rpath ${llvmShared}/lib"; # Enable nightly features in stable compiles (used for # bootstrapping, see https://github.com/rust-lang/rust/pull/37265). @@ -54,13 +60,12 @@ stdenv.mkDerivation { # We need rust to build rust. If we don't provide it, configure will try to download it. # Reference: https://github.com/rust-lang/rust/blob/master/src/bootstrap/configure.py configureFlags = configureFlags - ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" ] - ++ [ "--enable-vendor" ] - # ++ [ "--jemalloc-root=${jemalloc}/lib" - ++ [ "--default-linker=${targetPackages.stdenv.cc}/bin/cc" ] - ++ optional (!forceBundledLLVM) [ "--enable-llvm-link-shared" ] - ++ optional (targets != []) "--target=${target}" - ++ optional (!forceBundledLLVM) "--llvm-root=${llvmShared}"; + ++ [ "--enable-local-rust" "--local-rust-root=${rustPlatform.rust.rustc}" "--enable-rpath" + "--enable-vendor" + "--jemalloc-root=${prefixedJemalloc}/lib" + "--default-linker=${targetPackages.stdenv.cc}/bin/cc" ] + ++ optional (!withBundledLLVM) [ "--enable-llvm-link-shared" "--llvm-root=${llvmShared}" ] + ++ optional (targets != []) "--target=${target}"; # The bootstrap.py will generated a Makefile that then executes the build. # The BOOTSTRAP_ARGS used by this Makefile must include all flags to pass @@ -79,29 +84,13 @@ stdenv.mkDerivation { postPatch = '' patchShebangs src/etc - # Fix dynamic linking against llvm - #${optionalString (!forceBundledLLVM) ''sed -i 's/, kind = \\"static\\"//g' src/etc/mklldeps.py''} + ${optionalString (!withBundledLLVM) ''rm -rf src/llvm''} + rm -rf src/jemalloc # Fix the configure script to not require curl as we won't use it sed -i configure \ -e '/probe_need CFG_CURL curl/d' - # Fix the use of jemalloc prefixes which our jemalloc doesn't have - # TODO: reenable if we can figure out how to get our jemalloc to work - #[ -f src/liballoc_jemalloc/lib.rs ] && sed -i 's,je_,,g' src/liballoc_jemalloc/lib.rs - #[ -f src/liballoc/heap.rs ] && sed -i 's,je_,,g' src/liballoc/heap.rs # Remove for 1.4.0+ - - # Disable fragile tests. - rm -vr src/test/run-make/linker-output-non-utf8 || true - rm -vr src/test/run-make/issue-26092 || true - - # Remove test targeted at LLVM 3.9 - https://github.com/rust-lang/rust/issues/36835 - rm -vr src/test/run-pass/issue-36023.rs || true - - # Disable test getting stuck on hydra - possible fix: - # https://reviews.llvm.org/rL281650 - rm -vr src/test/run-pass/issue-36474.rs || true - # On Hydra: `TcpListener::bind(&addr)`: Address already in use (os error 98)' sed '/^ *fn fast_rebind()/i#[ignore]' -i src/libstd/net/tcp.rs @@ -116,35 +105,35 @@ stdenv.mkDerivation { # Disable all lldb tests. # error: Can't run LLDB test because LLDB's python path is not set rm -vr src/test/debuginfo/* - rm -v src/test/run-pass/backtrace-debuginfo.rs + rm -v src/test/run-pass/backtrace-debuginfo.rs || true # error: No such file or directory - rm -v src/test/run-pass/issue-45731.rs + rm -v src/test/ui/run-pass/issues/issue-45731.rs || true # Disable tests that fail when sandboxing is enabled. substituteInPlace src/libstd/sys/unix/ext/net.rs \ --replace '#[test]' '#[test] #[ignore]' substituteInPlace src/test/run-pass/env-home-dir.rs \ --replace 'home_dir().is_some()' true - rm -v src/test/run-pass/fds-are-cloexec.rs # FIXME: pipes? - rm -v src/test/run-pass/sync-send-in-std.rs # FIXME: ??? + rm -v src/test/run-pass/fds-are-cloexec.rs || true # FIXME: pipes? + rm -v src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs || true # FIXME: ??? ''; # rustc unfortunately need cmake for compiling llvm-rt but doesn't # use it for the normal build. This disables cmake in Nix. dontUseCmakeConfigure = true; - # (proc)ps is needed for one of the test cases + # ps is needed for one of the test cases nativeBuildInputs = - [ file python2 procps rustPlatform.rust.rustc git cmake - which libffi + [ file python2 ps rustPlatform.rust.rustc git cmake + which libffi removeReferencesTo ] # Only needed for the debuginfo tests ++ optional (!stdenv.isDarwin) gdb; - buildInputs = [ ncurses ] ++ targetToolchains + buildInputs = targetToolchains ++ optional stdenv.isDarwin Security - ++ optional (!forceBundledLLVM) llvmShared; + ++ optional (!withBundledLLVM) llvmShared; outputs = [ "out" "man" "doc" ]; setOutputFlags = false; @@ -165,6 +154,12 @@ stdenv.mkDerivation { inherit doCheck; + # remove references to llvm-config in lib/rustlib/x86_64-unknown-linux-gnu/codegen-backends/librustc_codegen_llvm-llvm.so + # and thus a transitive dependency on ncurses + postInstall = '' + find $out/lib -name "*.so" -type f -exec remove-references-to -t ${llvmShared} '{}' '+' + ''; + configurePlatforms = []; # https://github.com/NixOS/nixpkgs/pull/21742#issuecomment-272305764 diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 7b8743cff1b46..50d452177f3bf 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -7235,10 +7235,12 @@ with pkgs; }); inherit (rust) cargo rustc; - rust_1_29 = callPackage ../development/compilers/rust/1.29 - (stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) { - stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4' - }); + rust_1_31 = callPackage ../development/compilers/rust/1.31 ({ + inherit (darwin.apple_sdk.frameworks) CoreFoundation Security; + llvm = llvm_7; + } // stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) { + stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4' + }); buildRustCrate = callPackage ../build-support/rust/build-rust-crate.nix { };