From 08b73c1d587305d471f8214ce63baf0f7b00233f Mon Sep 17 00:00:00 2001 From: Yegor Timoshenko Date: Wed, 14 Aug 2019 11:59:41 +0000 Subject: [PATCH] buildRustPackage: fix cross-compilation to aarch64-unknown-linux-musl --- pkgs/build-support/rust/default.nix | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix index 6afe93c7e4c1b..1eea6b95d349d 100644 --- a/pkgs/build-support/rust/default.nix +++ b/pkgs/build-support/rust/default.nix @@ -86,6 +86,10 @@ in stdenv.mkDerivation (args // { ${stdenv.lib.optionalString (stdenv.buildPlatform.config != stdenv.hostPlatform.config) '' [target."${stdenv.hostPlatform.config}"] "linker" = "${ccForHost}" + ${# https://github.com/rust-lang/rust/issues/46651#issuecomment-433611633 + stdenv.lib.optionalString (stdenv.hostPlatform.isMusl && stdenv.hostPlatform.isAarch64) '' + "rustflags" = [ "-C", "target-feature=+crt-static", "-C", "link-arg=-lgcc" ] + ''} ''} EOF cat .cargo/config