about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2024-05-18 11:38:32 +0200
committerAlyssa Ross <hi@alyssa.is>2024-05-29 23:08:09 +0200
commit07f40e68920c149c9c8ce62e283d73bd98a1413b (patch)
tree708cedc10d3e52b287b465c37d84f6f669f7c50e
parenta21afc1d92e0361bb52b8fae4954c6110ab87c21 (diff)
rustc: don't try to use non-existent rust-lld
This removes the need to manually override Rust's default linker for
every package that builds for wasm32-unknown-unknown.
-rw-r--r--pkgs/applications/blockchains/polkadot/default.nix2
-rw-r--r--pkgs/applications/misc/pagefind/default.nix1
-rw-r--r--pkgs/by-name/re/rerun/package.nix2
-rw-r--r--pkgs/by-name/su/surrealist/package.nix2
-rw-r--r--pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix2
-rw-r--r--pkgs/development/compilers/rust/rustc.nix6
-rw-r--r--pkgs/servers/ldap/lldap/default.nix2
-rw-r--r--pkgs/servers/teleport/generic.nix4
8 files changed, 9 insertions, 12 deletions
diff --git a/pkgs/applications/blockchains/polkadot/default.nix b/pkgs/applications/blockchains/polkadot/default.nix
index 190bfc28d1327..0e71ddb7ba3bd 100644
--- a/pkgs/applications/blockchains/polkadot/default.nix
+++ b/pkgs/applications/blockchains/polkadot/default.nix
@@ -82,8 +82,6 @@ rustPlatform.buildRustPackage rec {
   # available for `rustc-wasm32`
   WASM_BUILD_STD = 0;
 
-  # NOTE: we need to force lld otherwise rust-lld is not found for wasm32 target
-  CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";
   OPENSSL_NO_VENDOR = 1;
   PROTOC = "${protobuf}/bin/protoc";
   ROCKSDB_LIB_DIR = "${rocksdb}/lib";
diff --git a/pkgs/applications/misc/pagefind/default.nix b/pkgs/applications/misc/pagefind/default.nix
index d1ae9f68270ec..2da4e5eb7eb10 100644
--- a/pkgs/applications/misc/pagefind/default.nix
+++ b/pkgs/applications/misc/pagefind/default.nix
@@ -96,7 +96,6 @@ rustPlatform.buildRustPackage rec {
     echo entering pagefind_web...
     (
       cd pagefind_web
-      export RUSTFLAGS="-C linker=lld"
       bash ./local_build.sh
     )
 
diff --git a/pkgs/by-name/re/rerun/package.nix b/pkgs/by-name/re/rerun/package.nix
index 844f97700c226..4d9c8da8041c0 100644
--- a/pkgs/by-name/re/rerun/package.nix
+++ b/pkgs/by-name/re/rerun/package.nix
@@ -78,8 +78,6 @@ rustPlatform.buildRustPackage rec {
     ]
     ++ lib.optionals stdenv.isLinux [ (lib.getLib wayland) ];
 
-  env.CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";
-
   addDlopenRunpaths = map (p: "${lib.getLib p}/lib") (
     lib.optionals stdenv.hostPlatform.isLinux [
       libxkbcommon
diff --git a/pkgs/by-name/su/surrealist/package.nix b/pkgs/by-name/su/surrealist/package.nix
index e67cf28fcdb60..efd1773dee2f8 100644
--- a/pkgs/by-name/su/surrealist/package.nix
+++ b/pkgs/by-name/su/surrealist/package.nix
@@ -83,7 +83,7 @@ in stdenv.mkDerivation (finalAttrs: {
     ];
 
     postBuild = ''
-      CC=clang CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER=lld cargo build \
+      CC=clang cargo build \
         --target wasm32-unknown-unknown \
         --release
 
diff --git a/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix b/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix
index a9c6f6080b03a..43102d6c8a26e 100644
--- a/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix
+++ b/pkgs/by-name/te/tetrio-desktop/tetrio-plus.nix
@@ -63,7 +63,7 @@ let
     ];
 
     buildPhase = ''
-      HOME=$(mktemp -d) RUSTFLAGS="-C linker=lld" wasm-pack build --target web --release
+      HOME=$(mktemp -d) wasm-pack build --target web --release
     '';
 
     installPhase = ''
diff --git a/pkgs/development/compilers/rust/rustc.nix b/pkgs/development/compilers/rust/rustc.nix
index 4c02692b75bd5..254732ed26035 100644
--- a/pkgs/development/compilers/rust/rustc.nix
+++ b/pkgs/development/compilers/rust/rustc.nix
@@ -192,6 +192,12 @@ in stdenv.mkDerivation (finalAttrs: {
   postPatch = ''
     patchShebangs src/etc
 
+    # rust-lld is the name rustup uses for its bundled lld, so that it
+    # doesn't conflict with any system lld.  This is not an
+    # appropriate default for Nixpkgs, where there is no rust-lld.
+    substituteInPlace compiler/rustc_target/src/spec/*/*.rs \
+      --replace-quiet '"rust-lld"' '"lld"'
+
     ${optionalString (!withBundledLLVM) "rm -rf src/llvm"}
 
     # Useful debugging parameter
diff --git a/pkgs/servers/ldap/lldap/default.nix b/pkgs/servers/ldap/lldap/default.nix
index cf4cc82ed8751..5097bf20dc7ac 100644
--- a/pkgs/servers/ldap/lldap/default.nix
+++ b/pkgs/servers/ldap/lldap/default.nix
@@ -51,7 +51,7 @@ let
     ];
 
     buildPhase = ''
-      HOME=`pwd` RUSTFLAGS="-C linker=lld" ./app/build.sh
+      HOME=`pwd` ./app/build.sh
     '';
 
     installPhase = ''
diff --git a/pkgs/servers/teleport/generic.nix b/pkgs/servers/teleport/generic.nix
index e47845ea56c6f..84b57160d4fa0 100644
--- a/pkgs/servers/teleport/generic.nix
+++ b/pkgs/servers/teleport/generic.nix
@@ -76,10 +76,6 @@ let
 
     cargoDeps = rustPlatform.importCargoLock cargoLock;
 
-    RUSTFLAGS = builtins.concatStringsSep " " [
-      "-C linker=lld"
-    ];
-
     nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++
       lib.optional (lib.versionAtLeast version "15") [
         binaryen