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.
This commit is contained in:
Alyssa Ross 2024-05-18 11:38:32 +02:00
parent a21afc1d92
commit 07f40e6892
8 changed files with 9 additions and 12 deletions

View File

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

View File

@ -96,7 +96,6 @@ rustPlatform.buildRustPackage rec {
echo entering pagefind_web...
(
cd pagefind_web
export RUSTFLAGS="-C linker=lld"
bash ./local_build.sh
)

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,7 @@ let
];
buildPhase = ''
HOME=`pwd` RUSTFLAGS="-C linker=lld" ./app/build.sh
HOME=`pwd` ./app/build.sh
'';
installPhase = ''

View File

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