3p/nixpkgs: fix aarch64-linux in buildRustCrate by using GCC11 and -lgcc
This commit is contained in:
parent
0d9fc34957
commit
d1ba763c67
5 changed files with 64 additions and 3 deletions
56
third_party/nixpkgs/patches/buildrustcrate-aarch64-linux.patch
vendored
Normal file
56
third_party/nixpkgs/patches/buildrustcrate-aarch64-linux.patch
vendored
Normal file
|
@ -0,0 +1,56 @@
|
|||
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 { };
|
1
third_party/nixpkgs/patches/series
vendored
1
third_party/nixpkgs/patches/series
vendored
|
@ -1,2 +1,3 @@
|
|||
kubo-multiaddr.patch
|
||||
prison-zxing.patch
|
||||
buildrustcrate-aarch64-linux.patch
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -15491,7 +15491,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 { };
|
||||
|
|
Loading…
Reference in a new issue