From 6783b22c9e888af4c0b5250be52865aa481f0c9f Mon Sep 17 00:00:00 2001 From: Raito Bezarius Date: Mon, 24 Jul 2023 17:42:43 +0200 Subject: rustc: support clang-based stdenv Previously, we were passing `cc` and `c++` all the time to rustc bootstrap process. This was wrong because `cc-rs` relies on the name of the compiler to detect whether this is Clang or a GNU GCC. Related: [1]: https://github.com/rust-lang/cc-rs/blob/df2f86ceafbe787698b890a3d6bde9f969d5fa88/src/lib.rs#L3334 [2]: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Missing.20dynamic.20libraries.20when.20bootstrapping.20Rust/near/377914373 --- pkgs/development/compilers/rust/rustc.nix | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'pkgs/development/compilers/rust/rustc.nix') diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 869dd15df0be9..774855c5c170a 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -66,15 +66,18 @@ in stdenv.mkDerivation rec { # 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 = let + prefixForStdenv = stdenv: "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}"; + ccPrefixForStdenv = stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang" else "cc"}"; + cxxPrefixForStdenv = stdenv: "${prefixForStdenv stdenv}${if (stdenv.cc.isClang or false) then "clang++" else "c++"}"; setBuild = "--set=target.${rust.toRustTarget stdenv.buildPlatform}"; setHost = "--set=target.${rust.toRustTarget stdenv.hostPlatform}"; setTarget = "--set=target.${rust.toRustTarget stdenv.targetPlatform}"; - ccForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}cc"; - cxxForBuild = "${pkgsBuildBuild.targetPackages.stdenv.cc}/bin/${pkgsBuildBuild.targetPackages.stdenv.cc.targetPrefix}c++"; - ccForHost = "${pkgsBuildHost.targetPackages.stdenv.cc}/bin/${pkgsBuildHost.targetPackages.stdenv.cc.targetPrefix}cc"; - cxxForHost = "${pkgsBuildHost.targetPackages.stdenv.cc}/bin/${pkgsBuildHost.targetPackages.stdenv.cc.targetPrefix}c++"; - ccForTarget = "${pkgsBuildTarget.targetPackages.stdenv.cc}/bin/${pkgsBuildTarget.targetPackages.stdenv.cc.targetPrefix}cc"; - cxxForTarget = "${pkgsBuildTarget.targetPackages.stdenv.cc}/bin/${pkgsBuildTarget.targetPackages.stdenv.cc.targetPrefix}c++"; + ccForBuild = ccPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv; + cxxForBuild = cxxPrefixForStdenv pkgsBuildBuild.targetPackages.stdenv; + ccForHost = ccPrefixForStdenv pkgsBuildHost.targetPackages.stdenv; + cxxForHost = cxxPrefixForStdenv pkgsBuildHost.targetPackages.stdenv; + ccForTarget = ccPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv; + cxxForTarget = cxxPrefixForStdenv pkgsBuildTarget.targetPackages.stdenv; in [ "--release-channel=stable" "--set=build.rustc=${rustc}/bin/rustc" -- cgit 1.4.1 From c11cb00a1e86d63b4d6599fe774e22b1c02f10c9 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 9 Oct 2023 13:02:41 +0000 Subject: rustc: 1.72.1 -> 1.73.0 This upgrade unfortunately removes MIPS support, as it has been dropped to Tier 3[1] and so bootstrap tarballs are no longer provided. It looks like it was dropped due to multiple codegen bugs, and lack of maintenance, so bringing it back would probably involve engaging with Rust/LLVM upstream on those. [1]: https://github.com/rust-lang/compiler-team/issues/648 --- .../rust/build-rust-package/default.nix | 3 +- pkgs/development/compilers/rust/1_72.nix | 61 ---------------------- pkgs/development/compilers/rust/1_73.nix | 60 +++++++++++++++++++++ pkgs/development/compilers/rust/print-hashes.sh | 1 - pkgs/development/compilers/rust/rustc.nix | 5 +- pkgs/top-level/all-packages.nix | 8 +-- 6 files changed, 68 insertions(+), 70 deletions(-) delete mode 100644 pkgs/development/compilers/rust/1_72.nix create mode 100644 pkgs/development/compilers/rust/1_73.nix (limited to 'pkgs/development/compilers/rust/rustc.nix') diff --git a/pkgs/build-support/rust/build-rust-package/default.nix b/pkgs/build-support/rust/build-rust-package/default.nix index da868861e2ca0..a27c1de013b19 100644 --- a/pkgs/build-support/rust/build-rust-package/default.nix +++ b/pkgs/build-support/rust/build-rust-package/default.nix @@ -156,7 +156,8 @@ stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "carg # Platforms without host tools from # https://doc.rust-lang.org/nightly/rustc/platform-support.html "armv7a-darwin" - "armv5tel-linux" "armv7a-linux" "m68k-linux" "riscv32-linux" + "armv5tel-linux" "armv7a-linux" "m68k-linux" "mipsel-linux" + "mips64el-linux" "riscv32-linux" "armv6l-netbsd" "x86_64-redox" "wasm32-wasi" diff --git a/pkgs/development/compilers/rust/1_72.nix b/pkgs/development/compilers/rust/1_72.nix deleted file mode 100644 index f540c229c6ff6..0000000000000 --- a/pkgs/development/compilers/rust/1_72.nix +++ /dev/null @@ -1,61 +0,0 @@ -# New rust versions should first go to staging. -# Things to check after updating: -# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin: -# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github -# This testing can be also done by other volunteers as part of the pull -# request review, in case platforms cannot be covered. -# 2. The LLVM version used for building should match with rust upstream. -# Check the version number in the src/llvm-project git submodule in: -# https://github.com/rust-lang/rust/blob//.gitmodules -# 3. Firefox and Thunderbird should still build on x86_64-linux. - -{ stdenv, lib -, buildPackages -, targetPackages -, newScope, callPackage -, CoreFoundation, Security, SystemConfiguration -, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost -, makeRustPlatform -, llvmPackages_16, llvm_16 -} @ args: - -import ./default.nix { - rustcVersion = "1.72.1"; - rustcSha256 = "sha256-f0iEX2pSzbtdY/sFKP1fUg60QydbVfmOMoFZ+GVo+JU="; - - llvmSharedForBuild = pkgsBuildBuild.llvmPackages_16.libllvm.override { enableSharedLibraries = true; }; - llvmSharedForHost = pkgsBuildHost.llvmPackages_16.libllvm.override { enableSharedLibraries = true; }; - llvmSharedForTarget = pkgsBuildTarget.llvmPackages_16.libllvm.override { enableSharedLibraries = true; }; - - # For use at runtime - llvmShared = llvm_16.override { enableSharedLibraries = true; }; - - # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox - llvmPackages = llvmPackages_16; - - # Note: the version MUST be one version prior to the version we're - # building - bootstrapVersion = "1.71.1"; - - # fetch hashes by running `print-hashes.sh ${bootstrapVersion}` - bootstrapHashes = { - i686-unknown-linux-gnu = "ea544e213cdf65194d9650df9d521dd2ed63251e2abe89c8123e336dfe580b21"; - x86_64-unknown-linux-gnu = "34778d1cda674990dfc0537bc600066046ae9cb5d65a07809f7e7da31d4689c4"; - x86_64-unknown-linux-musl = "67acc1744293e52f4b49231f3c503e8ad187c477e7b567e27925ec792d946a01"; - arm-unknown-linux-gnueabihf = "4c88b32849132504fce5b93bebf06dd0fa17988340c7fe97afa661e038dfa258"; - armv7-unknown-linux-gnueabihf = "8f8556dbd8b0350364c7dc8fda57549934bf3c26c65498dda5842087f5c90d60"; - aarch64-unknown-linux-gnu = "c7cf230c740a62ea1ca6a4304d955c286aea44e3c6fc960b986a8c2eeea4ec3f"; - aarch64-unknown-linux-musl = "da87f4ca2534886f1006b2e8abb0dda8db231ce82cc67b4857233ad48a21c87c"; - x86_64-apple-darwin = "916056603da88336aba68bbeab49711cc8fdb9cfb46a49b04850c0c09761f58c"; - aarch64-apple-darwin = "f4061b65b31ac75b9b5384c1f518e555f3da23f93bcf64dce252461ee65e9351"; - powerpc64le-unknown-linux-gnu = "bac57066882366e4628d1ed2bbe4ab19c0b373aaf45582c2da9f639f2f6ea537"; - riscv64gc-unknown-linux-gnu = "fcb67647b764669f3b4e61235fbdc0eca287229adf9aed8c41ce20ffaad4a3ea"; - mips64el-unknown-linux-gnuabi64 = "6523efea9cd48c0375bd621460d890c65457a5534fafb2d8b69a37ee1e2a39ed"; - }; - - selectRustPackage = pkgs: pkgs.rust_1_72; - - rustcPatches = [ ]; -} - -(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildHost" "llvmPackages_16" "llvm_16"]) diff --git a/pkgs/development/compilers/rust/1_73.nix b/pkgs/development/compilers/rust/1_73.nix new file mode 100644 index 0000000000000..37e75e0a7a4f1 --- /dev/null +++ b/pkgs/development/compilers/rust/1_73.nix @@ -0,0 +1,60 @@ +# New rust versions should first go to staging. +# Things to check after updating: +# 1. Rustc should produce rust binaries on x86_64-linux, aarch64-linux and x86_64-darwin: +# i.e. nix-shell -p fd or @GrahamcOfBorg build fd on github +# This testing can be also done by other volunteers as part of the pull +# request review, in case platforms cannot be covered. +# 2. The LLVM version used for building should match with rust upstream. +# Check the version number in the src/llvm-project git submodule in: +# https://github.com/rust-lang/rust/blob//.gitmodules +# 3. Firefox and Thunderbird should still build on x86_64-linux. + +{ stdenv, lib +, buildPackages +, targetPackages +, newScope, callPackage +, CoreFoundation, Security, SystemConfiguration +, pkgsBuildTarget, pkgsBuildBuild, pkgsBuildHost +, makeRustPlatform +, llvmPackages_16, llvm_16 +} @ args: + +import ./default.nix { + rustcVersion = "1.73.0"; + rustcSha256 = "sha256-ltYubR8tId96yKyzuYgkEfnnxwNhc/fy7enh8faxuzo="; + + llvmSharedForBuild = pkgsBuildBuild.llvmPackages_16.libllvm.override { enableSharedLibraries = true; }; + llvmSharedForHost = pkgsBuildHost.llvmPackages_16.libllvm.override { enableSharedLibraries = true; }; + llvmSharedForTarget = pkgsBuildTarget.llvmPackages_16.libllvm.override { enableSharedLibraries = true; }; + + # For use at runtime + llvmShared = llvm_16.override { enableSharedLibraries = true; }; + + # Expose llvmPackages used for rustc from rustc via passthru for LTO in Firefox + llvmPackages = llvmPackages_16; + + # Note: the version MUST be one version prior to the version we're + # building + bootstrapVersion = "1.72.1"; + + # fetch hashes by running `print-hashes.sh ${bootstrapVersion}` + bootstrapHashes = { + i686-unknown-linux-gnu = "a2a849a701dfd6643aaaa27e1ed5ac56aea00f7dee26c00d81c520808efd8911"; + x86_64-unknown-linux-gnu = "4fbd8df2000cf73c632d67a219a7fc153537ceffa2e6474491e3db71fdd5a410"; + x86_64-unknown-linux-musl = "94eddc044868a944a887d0b0375e393cb3acc6ebc034e3eac2ef2890ec7c0eac"; + arm-unknown-linux-gnueabihf = "a4d90538882181722d3e7cb8d7f021770e29e6b6d28375452e31a98049600110"; + armv7-unknown-linux-gnueabihf = "4c8e6b3c705a84d17894d3a1cfe744fb6083dd57c61868e67aac8b8512640ecb"; + aarch64-unknown-linux-gnu = "190d0473cbe619f163d33a6c4e2ef982abdd4178f73abc3194631cd2d5c8ed8b"; + aarch64-unknown-linux-musl = "c83778d1a95f6604bc3610a9070e8a8435c60a8bca5117aad71ffab36dea020f"; + x86_64-apple-darwin = "d01e7e9a7482f88a51b4fd888f06234274b49f51b5476c2d14fd46fd6e99ba9e"; + aarch64-apple-darwin = "42b0aaf269b6d9c60db13a64a920336d6064ab11d0c7043c9deeb9d4f67b3983"; + powerpc64le-unknown-linux-gnu = "9310df247efc072f2ca27354a875c4989cf3c29c9e545255a7472895d830163c"; + riscv64gc-unknown-linux-gnu = "1e08cd3ecd29d5bf247e3f7f4bc97318b439f0443dd9c99c36edcfa717d55101"; + }; + + selectRustPackage = pkgs: pkgs.rust_1_73; + + rustcPatches = [ ]; +} + +(builtins.removeAttrs args [ "pkgsBuildTarget" "pkgsBuildHost" "llvmPackages_16" "llvm_16"]) diff --git a/pkgs/development/compilers/rust/print-hashes.sh b/pkgs/development/compilers/rust/print-hashes.sh index dd2c116a341b9..ebf8d900bb3b5 100755 --- a/pkgs/development/compilers/rust/print-hashes.sh +++ b/pkgs/development/compilers/rust/print-hashes.sh @@ -19,7 +19,6 @@ PLATFORMS=( aarch64-apple-darwin powerpc64le-unknown-linux-gnu riscv64gc-unknown-linux-gnu - mips64el-unknown-linux-gnuabi64 ) BASEURL=https://static.rust-lang.org/dist VERSION=${1:-} diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix index 0cf5020962cf1..32178bfc10289 100644 --- a/pkgs/development/compilers/rust/rustc.nix +++ b/pkgs/development/compilers/rust/rustc.nix @@ -272,9 +272,8 @@ in stdenv.mkDerivation rec { "i686-freebsd13" "x86_64-freebsd13" "x86_64-solaris" "aarch64-linux" "armv6l-linux" "armv7l-linux" "i686-linux" - "loongarch64-linux" "mipsel-linux" "mips64el-linux" - "powerpc64-linux" "powerpc64le-linux" "riscv64-linux" - "s390x-linux" "x86_64-linux" + "loongarch64-linux" "powerpc64-linux" "powerpc64le-linux" + "riscv64-linux" "s390x-linux" "x86_64-linux" "aarch64-netbsd" "armv7l-netbsd" "i686-netbsd" "powerpc-netbsd" "x86_64-netbsd" "i686-openbsd" "x86_64-openbsd" diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index b429c1d2c6afa..6c7b9c158595d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17182,11 +17182,11 @@ with pkgs; inherit (darwin) apple_sdk; }; - rust_1_72 = callPackage ../development/compilers/rust/1_72.nix { + rust_1_73 = callPackage ../development/compilers/rust/1_73.nix { inherit (darwin.apple_sdk.frameworks) CoreFoundation Security SystemConfiguration; llvm_16 = llvmPackages_16.libllvm; }; - rust = rust_1_72; + rust = rust_1_73; mrustc = callPackage ../development/compilers/mrustc { }; mrustc-minicargo = callPackage ../development/compilers/mrustc/minicargo.nix { }; @@ -17194,8 +17194,8 @@ with pkgs; openssl = openssl_1_1; }; - rustPackages_1_72 = rust_1_72.packages.stable; - rustPackages = rustPackages_1_72; + rustPackages_1_73 = rust_1_73.packages.stable; + rustPackages = rustPackages_1_73; inherit (rustPackages) cargo cargo-auditable cargo-auditable-cargo-wrapper clippy rustc rustPlatform; -- cgit 1.4.1