rust.envVars: use wrapped LLD for aarch64 musl

The unwrapped version doesn't know where to look for libraries, so
this is required to e.g. build anything that uses openssl-sys with
OPENSSL_NO_VENDOR.  A randomly chosen example package that's fixed by
this change is pkgsStatic.gitoxide.
This commit is contained in:
Alyssa Ross 2024-01-23 15:51:03 +01:00
parent f3a07da669
commit 3bf20e5bf8
No known key found for this signature in database
GPG Key ID: F9DBED4859B271C0
3 changed files with 8 additions and 4 deletions

View File

@ -1,6 +1,7 @@
{ lib
, stdenv
, pkgsBuildHost
, pkgsBuildTarget
, pkgsTargetTarget
}:
@ -24,7 +25,7 @@ rec {
cxxForHost = "${stdenv.cc}/bin/${stdenv.cc.targetPrefix}c++";
linkerForHost = if shouldUseLLD stdenv.targetPlatform
&& !stdenv.cc.bintools.isLLVM
then "${pkgsBuildHost.lld}/bin/ld.lld"
then "${pkgsBuildHost.llvmPackages.bintools}/bin/${stdenv.cc.targetPrefix}ld.lld"
else ccForHost;
# Unfortunately we must use the dangerous `pkgsTargetTarget` here
@ -35,7 +36,7 @@ rec {
cxxForTarget = "${pkgsTargetTarget.stdenv.cc}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}c++";
linkerForTarget = if shouldUseLLD pkgsTargetTarget.stdenv.targetPlatform
&& !pkgsTargetTarget.stdenv.cc.bintools.isLLVM # whether stdenv's linker is lld already
then "${pkgsBuildHost.lld}/bin/ld.lld"
then "${pkgsBuildTarget.llvmPackages.bintools}/bin/${pkgsTargetTarget.stdenv.cc.targetPrefix}ld.lld"
else ccForTarget;
rustBuildPlatform = stdenv.buildPlatform.rust.rustcTarget;

View File

@ -56,4 +56,4 @@ import ./default.nix {
rustcPatches = [ ];
}
(builtins.removeAttrs args [ "pkgsBuildTarget" "llvmPackages_17" "llvm_17"])
(builtins.removeAttrs args [ "llvmPackages_17" "llvm_17"])

View File

@ -16,6 +16,7 @@
, CoreFoundation, Security, SystemConfiguration
, pkgsBuildBuild
, pkgsBuildHost
, pkgsBuildTarget
, pkgsTargetTarget
, makeRustPlatform
, wrapRustcWith
@ -23,7 +24,9 @@
let
# Use `import` to make sure no packages sneak in here.
lib' = import ../../../build-support/rust/lib { inherit lib stdenv pkgsBuildHost pkgsTargetTarget; };
lib' = import ../../../build-support/rust/lib {
inherit lib stdenv pkgsBuildHost pkgsBuildTarget pkgsTargetTarget;
};
# Allow faster cross compiler generation by reusing Build artifacts
fastCross = (stdenv.buildPlatform == stdenv.hostPlatform) && (stdenv.hostPlatform != stdenv.targetPlatform);
in