mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
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:
parent
a21afc1d92
commit
07f40e6892
@ -82,8 +82,6 @@ rustPlatform.buildRustPackage rec {
|
|||||||
# available for `rustc-wasm32`
|
# available for `rustc-wasm32`
|
||||||
WASM_BUILD_STD = 0;
|
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;
|
OPENSSL_NO_VENDOR = 1;
|
||||||
PROTOC = "${protobuf}/bin/protoc";
|
PROTOC = "${protobuf}/bin/protoc";
|
||||||
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
ROCKSDB_LIB_DIR = "${rocksdb}/lib";
|
||||||
|
@ -96,7 +96,6 @@ rustPlatform.buildRustPackage rec {
|
|||||||
echo entering pagefind_web...
|
echo entering pagefind_web...
|
||||||
(
|
(
|
||||||
cd pagefind_web
|
cd pagefind_web
|
||||||
export RUSTFLAGS="-C linker=lld"
|
|
||||||
bash ./local_build.sh
|
bash ./local_build.sh
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -78,8 +78,6 @@ rustPlatform.buildRustPackage rec {
|
|||||||
]
|
]
|
||||||
++ lib.optionals stdenv.isLinux [ (lib.getLib wayland) ];
|
++ lib.optionals stdenv.isLinux [ (lib.getLib wayland) ];
|
||||||
|
|
||||||
env.CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER = "lld";
|
|
||||||
|
|
||||||
addDlopenRunpaths = map (p: "${lib.getLib p}/lib") (
|
addDlopenRunpaths = map (p: "${lib.getLib p}/lib") (
|
||||||
lib.optionals stdenv.hostPlatform.isLinux [
|
lib.optionals stdenv.hostPlatform.isLinux [
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
|
@ -83,7 +83,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
];
|
];
|
||||||
|
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
CC=clang CARGO_TARGET_WASM32_UNKNOWN_UNKNOWN_LINKER=lld cargo build \
|
CC=clang cargo build \
|
||||||
--target wasm32-unknown-unknown \
|
--target wasm32-unknown-unknown \
|
||||||
--release
|
--release
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ let
|
|||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
HOME=$(mktemp -d) RUSTFLAGS="-C linker=lld" wasm-pack build --target web --release
|
HOME=$(mktemp -d) wasm-pack build --target web --release
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -192,6 +192,12 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
postPatch = ''
|
postPatch = ''
|
||||||
patchShebangs src/etc
|
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"}
|
${optionalString (!withBundledLLVM) "rm -rf src/llvm"}
|
||||||
|
|
||||||
# Useful debugging parameter
|
# Useful debugging parameter
|
||||||
|
@ -51,7 +51,7 @@ let
|
|||||||
];
|
];
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
HOME=`pwd` RUSTFLAGS="-C linker=lld" ./app/build.sh
|
HOME=`pwd` ./app/build.sh
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
@ -76,10 +76,6 @@ let
|
|||||||
|
|
||||||
cargoDeps = rustPlatform.importCargoLock cargoLock;
|
cargoDeps = rustPlatform.importCargoLock cargoLock;
|
||||||
|
|
||||||
RUSTFLAGS = builtins.concatStringsSep " " [
|
|
||||||
"-C linker=lld"
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++
|
nativeBuildInputs = [ nodejs yarn fixup-yarn-lock ] ++
|
||||||
lib.optional (lib.versionAtLeast version "15") [
|
lib.optional (lib.versionAtLeast version "15") [
|
||||||
binaryen
|
binaryen
|
||||||
|
Loading…
Reference in New Issue
Block a user