From a9ee50d9536e4af26d7ca7917364114f5c2f9b40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliv=C3=A9r=20Falvai?= Date: Wed, 25 Dec 2024 12:34:46 +0100 Subject: [PATCH] deno: fix clang build failure https://hydra.nixos.org/build/282160517/log/tail --- pkgs/by-name/de/deno/package.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/pkgs/by-name/de/deno/package.nix b/pkgs/by-name/de/deno/package.nix index 680c352d8433..a8a3ec169f9c 100644 --- a/pkgs/by-name/de/deno/package.nix +++ b/pkgs/by-name/de/deno/package.nix @@ -12,6 +12,7 @@ librusty_v8 ? callPackage ./librusty_v8.nix { inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8; }, + libffi, }: let @@ -33,7 +34,10 @@ rustPlatform.buildRustPackage rec { postPatch = '' # upstream uses lld on aarch64-darwin for faster builds # within nix lld looks for CoreFoundation rather than CoreFoundation.tbd and fails - substituteInPlace .cargo/config.toml --replace "-fuse-ld=lld " "" + substituteInPlace .cargo/config.toml --replace-fail "-fuse-ld=lld " "" + + # Use patched nixpkgs libffi in order to fix https://github.com/libffi/libffi/pull/857 + substituteInPlace ext/ffi/Cargo.toml --replace-fail "libffi = \"=3.2.0\"" "libffi = { version = \"3.2.0\", features = [\"system\"] }" ''; # uses zlib-ng but can't dynamically link yet @@ -46,7 +50,12 @@ rustPlatform.buildRustPackage rec { installShellFiles ]; - buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ + configureFlags = lib.optionals stdenv.cc.isClang [ + # This never worked with clang, but became a hard error recently: https://github.com/llvm/llvm-project/commit/3d5b610c864c8f5980eaa16c22b71ff1cf462fae + "--disable-multi-os-directory" + ]; + + buildInputs = [ libffi ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ apple-sdk_11 # V8 supports 10.15+; binary references `aligned_alloc` directly (darwinMinVersionHook "10.15")