56 lines
2.5 KiB
Diff
56 lines
2.5 KiB
Diff
diff --git a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
|
|
index 1c946764c758..637c9fc62f2e 100644
|
|
--- a/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
|
|
+++ b/pkgs/build-support/rust/build-rust-crate/configure-crate.nix
|
|
@@ -1,6 +1,7 @@
|
|
{ lib, stdenv, rust, echo_colored, noisily, mkRustcDepArgs, mkRustcFeatureArgs }:
|
|
{
|
|
- build
|
|
+ aarch64LinuxGccWorkaround
|
|
+, build
|
|
, buildDependencies
|
|
, codegenUnits
|
|
, colors
|
|
@@ -52,6 +53,7 @@ in ''
|
|
noisily cd "$cargo_toml_dir"
|
|
''}
|
|
|
|
+ export NIX_LDFLAGS+=" ${aarch64LinuxGccWorkaround}"
|
|
runHook preConfigure
|
|
|
|
symlink_dependency() {
|
|
diff --git a/pkgs/build-support/rust/build-rust-crate/default.nix b/pkgs/build-support/rust/build-rust-crate/default.nix
|
|
index 98030225bcbb..700e21a72237 100644
|
|
--- a/pkgs/build-support/rust/build-rust-crate/default.nix
|
|
+++ b/pkgs/build-support/rust/build-rust-crate/default.nix
|
|
@@ -80,6 +80,8 @@ let
|
|
|
|
installCrate = import ./install-crate.nix { inherit stdenv; };
|
|
|
|
+ aarch64LinuxGccWorkaround = lib.optionalString (stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU) "-lgcc";
|
|
+
|
|
# Allow access to the rust attribute set from inside buildRustCrate, which
|
|
# has a parameter that shadows the name.
|
|
rustAttrs = rust;
|
|
@@ -341,7 +343,7 @@ crate_: lib.makeOverridable
|
|
configurePhase = configureCrate {
|
|
inherit crateName buildDependencies completeDeps completeBuildDeps crateDescription
|
|
crateFeatures crateRenames libName build workspace_member release libPath crateVersion
|
|
- extraLinkFlags extraRustcOptsForBuildRs
|
|
+ extraLinkFlags extraRustcOptsForBuildRs aarch64LinuxGccWorkaround
|
|
crateAuthors crateHomepage verbose colors codegenUnits;
|
|
};
|
|
buildPhase = buildCrate {
|
|
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
|
|
index 819c43791048..4709bac36359 100644
|
|
--- a/pkgs/top-level/all-packages.nix
|
|
+++ b/pkgs/top-level/all-packages.nix
|
|
@@ -15505,7 +15505,7 @@ with pkgs;
|
|
|
|
makeRustPlatform = callPackage ../development/compilers/rust/make-rust-platform.nix {};
|
|
|
|
- buildRustCrate = callPackage ../build-support/rust/build-rust-crate { };
|
|
+ buildRustCrate = callPackage ../build-support/rust/build-rust-crate { stdenv = if stdenv.isLinux && stdenv.isAarch64 && stdenv.cc.isGNU then gcc11Stdenv else stdenv; };
|
|
buildRustCrateHelpers = callPackage ../build-support/rust/build-rust-crate/helpers.nix { };
|
|
|
|
cargo2junit = callPackage ../development/tools/rust/cargo2junit { };
|