buildRustPackage: fix cross-compilation to aarch64-unknown-linux-musl

This commit is contained in:
Yegor Timoshenko 2019-08-14 11:59:41 +00:00
parent ddf15d321f
commit 08b73c1d58
No known key found for this signature in database
GPG key ID: B0B0D739BB47A03A

View file

@ -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