Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust: 1.51.0 -> 1.52.0 #122110

Merged
merged 1 commit into from
May 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkgs/build-support/rust/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
, git
, rust
, rustc
, libiconv
, windows
}:

Expand Down Expand Up @@ -117,7 +118,9 @@ stdenv.mkDerivation ((removeAttrs args ["depsExtraArgs"]) // lib.optionalAttrs u
rustc
];

buildInputs = buildInputs ++ lib.optional stdenv.hostPlatform.isMinGW windows.pthreads;
buildInputs = buildInputs
++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the update, I tried to build fd and ripgrep. They both failed on missing libiconv error. Rather than adding libiconv to buildInputs of thousands of individual rust packages, I feel this is the better way to go.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to agree if this is a dependency of the rust stdlib, otherwise I would keep it rather explicit than bloating the default closure size.. What part in fd and ripgrep depends on libiconv?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But let's ask some darwin maintainer: @LnL7 @thefloweringash @abathur

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been able to pinpoint it, but I think it's clap.
I've made the fix to about 10 packages so far. I don't mind, the only problem is that for some of them, people don't spot the breakage, until somebody running on darwin comes along.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior discussion: #95556

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think darwin support can be done in another PR. AFAIK, this would have been an existing issue, and I would rather not delay this PR. Darwin maintainers have around 5 days to come up with a solution before the final staging-next cycle will begin before branch-off of 21.05

Copy link
Contributor

@jonringer jonringer May 8, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I don't think having libiconv as a buildInput will bloat too much, as the likelihood of another package requiring it should be very high.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I have found the culprit. The libc crate used to unconditionally link libiconv on Apple platforms:

    if target.contains("-apple-") {
        println!("cargo:rustc-link-lib=iconv");
    }

libc is a transitive dependency of many widely-used crates, such as rand, memchr, and chrono, so it percolates through much of the Nix ecosystem.

However, this dependency is now made conditional in libc (only needed when libiconv symbols are used):

rust-lang/libc#2150

So, I propose that we revert adding libiconv as a buildinput, since it will become unnecessary as more and more crates adopt the next version of libc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@danieldk Thanks for investigating the issue - I guess we can revert the libiconv addition together with once libc 0.2.95 update once it is out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposed PR to remove the dependency #122231.

++ lib.optionals stdenv.hostPlatform.isMinGW [ windows.pthreads ];

patches = cargoPatches ++ patches;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
} @ args:

import ./default.nix {
rustcVersion = "1.51.0";
rustcSha256 = "0ixqkqglv3isxbvl4ldr4byrkx692wghsz3fasy1pn5kr2prnsvs";
rustcVersion = "1.52.0";
rustcSha256 = "0qws6xwc4x4sq3nzlzfy9b126g6wqfa6gmydg0hswkx225dw9gik";

llvmSharedForBuild = pkgsBuildBuild.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
llvmSharedForHost = pkgsBuildHost.llvmPackages_11.libllvm.override { enableSharedLibraries = true; };
Expand All @@ -33,23 +33,23 @@ import ./default.nix {

# Note: the version MUST be one version prior to the version we're
# building
bootstrapVersion = "1.50.0";
bootstrapVersion = "1.51.0";

# fetch hashes by running `print-hashes.sh ${bootstrapVersion}`
bootstrapHashes = {
i686-unknown-linux-gnu = "dee56dc425ed5d8e8112f26fba3060fd324c49f1261e0b7e8e29f7d9b852b09a";
x86_64-unknown-linux-gnu = "fa889b53918980aea2dea42bfae4e858dcb2104c6fdca6e4fe359f3a49767701";
x86_64-unknown-linux-musl = "867cbfb35f5dc9b43e230132ea9e7bfa98d471a9248e41b08ced2266e5ccd00f";
arm-unknown-linux-gnueabihf = "1b72979244450e4047ab536448d6720699e1fae0ab1c4ade114099a3037e274b";
armv7-unknown-linux-gnueabihf = "f1dde566c4e6ca2e1133c84170e46e566765a21894e1038e1cdc32745d7274ef";
aarch64-unknown-linux-gnu = "1db7a4fbddc68cd29eb9bca9fa7d0d2d9e3d59ede7ddaad66222fb4336a6bacf";
aarch64-unknown-linux-musl = "adcc6c76a8967bacb6687b565d3cf739e35fde066b03edb745b05b52fa8b5b36";
x86_64-apple-darwin = "1bf5a7ecf6468ce1bf9fe49c8083b3f648b40c16fbfb7539d106fe28eb0e792e";
aarch64-apple-darwin = "1ed91a867e7b86cc4bc84c0838240f1c25acd007100ec9f7a14c4873e4b56561";
powerpc64le-unknown-linux-gnu = "e0472589d3f9ba7ebf27f033af320e0d5cfb70222955bd8ed73ce2c9a70ae535";
i686-unknown-linux-gnu = "de2e8ef724d89ba6f567f07ebacf5a244c7cdae30ee559f1913310eda38d9cd1";
x86_64-unknown-linux-gnu = "9e125977aa13f012a68fdc6663629c685745091ae244f0587dd55ea4e3a3e42f";
x86_64-unknown-linux-musl = "cb65c3a19ba0e09a94ccfd8551e648efaa1db52b0db19ae475d35a46f8750871";
arm-unknown-linux-gnueabihf = "ab26464947ce80b4c361b08242dc215a5664f9f4ad23f66891ec27d55a0440b7";
armv7-unknown-linux-gnueabihf = "5d381b7ee16c559efefedfac7ec4d392e838fddaf50049255844dcff2b2614dd";
aarch64-unknown-linux-gnu = "fd31c78fffad52c03cac5a7c1ee5db3f34b2a77d7bc862707c0f71e209180a84";
aarch64-unknown-linux-musl = "06cdaa1117dcdd392ede938b655b9bc45cf2a76bd42870ca223189e6eb29d435";
x86_64-apple-darwin = "765212098a415996b767d1e372ce266caf94027402b269fec33291fffc085ca4";
aarch64-apple-darwin = "95d0410bbd20b05f8b7d5adf70e8737873995bc86611a90e643d7081ca35147f";
powerpc64le-unknown-linux-gnu = "7362f561104d7be4836507d3a53cd39444efcdf065813d559beb1f54ce9f7680";
};

selectRustPackage = pkgs: pkgs.rust_1_51;
selectRustPackage = pkgs: pkgs.rust_1_52;

rustcPatches = [
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/compilers/rust/cargo.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ lib, stdenv, file, curl, pkg-config, python3, openssl, cmake, zlib
, installShellFiles, makeWrapper, libiconv, cacert, rustPlatform, rustc
, installShellFiles, makeWrapper, cacert, rustPlatform, rustc
, CoreFoundation, Security
}:

Expand All @@ -18,7 +18,7 @@ rustPlatform.buildRustPackage {

nativeBuildInputs = [ pkg-config cmake installShellFiles makeWrapper ];
buildInputs = [ cacert file curl python3 openssl zlib ]
++ lib.optionals stdenv.isDarwin [ CoreFoundation Security libiconv ];
++ lib.optionals stdenv.isDarwin [ CoreFoundation Security ];

# cargo uses git-rs which is made for a version of libgit2 from recent master that
# is not compatible with the current version in nixpkgs.
Expand Down
3 changes: 2 additions & 1 deletion pkgs/development/compilers/rust/rustc.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
, fetchurl, file, python3
, darwin, cmake, rust, rustPlatform
, pkg-config, openssl
, libiconv
, which, libffi
, withBundledLLVM ? false
, enableRustcDev ? true
Expand Down Expand Up @@ -137,7 +138,7 @@ in stdenv.mkDerivation rec {
];

buildInputs = [ openssl ]
++ optional stdenv.isDarwin Security
++ optionals stdenv.isDarwin [ libiconv Security ]
++ optional (!withBundledLLVM) llvmShared;

outputs = [ "out" "man" "doc" ];
Expand Down
8 changes: 4 additions & 4 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -11394,19 +11394,19 @@ in
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
llvm_10 = llvmPackages_10.libllvm;
};
rust_1_51 = callPackage ../development/compilers/rust/1_51.nix {
rust_1_52 = callPackage ../development/compilers/rust/1_52.nix {
inherit (darwin.apple_sdk.frameworks) CoreFoundation Security;
llvm_11 = llvmPackages_11.libllvm;
};
rust = rust_1_51;
rust = rust_1_52;

mrustc = callPackage ../development/compilers/mrustc { };
mrustc-minicargo = callPackage ../development/compilers/mrustc/minicargo.nix { };
mrustc-bootstrap = callPackage ../development/compilers/mrustc/bootstrap.nix { };

rustPackages_1_45 = rust_1_45.packages.stable;
rustPackages_1_51 = rust_1_51.packages.stable;
rustPackages = rustPackages_1_51;
rustPackages_1_52 = rust_1_52.packages.stable;
rustPackages = rustPackages_1_52;

inherit (rustPackages) cargo clippy rustc rustPlatform;

Expand Down