From 8164b1909683807e43bc4d22ecdb8b396ca5fef9 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Wed, 8 Nov 2023 21:54:55 -0500 Subject: [PATCH] haskell-modules/generic-builder.nix: work around libc++abi issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Work around clang’s not linking libc++abi when invoked as `clang` or `cc` even when it’s needed to link a C++ library or C++ code. See https://github.com/NixOS/nixpkgs/issues/166205. --- pkgs/development/haskell-modules/generic-builder.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 7001e4220bae8..6cfd92fb43074 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -811,5 +811,12 @@ stdenv.mkDerivation ({ // optionalAttrs (args ? dontStrip) { inherit dontStrip; } // optionalAttrs (postPhases != []) { inherit postPhases; } // optionalAttrs (stdenv.buildPlatform.libc == "glibc"){ LOCALE_ARCHIVE = "${glibcLocales}/lib/locale/locale-archive"; } + +# Ensure libc++abi is linked even when clang is invoked as just `clang` or `cc`. +# Works around https://github.com/NixOS/nixpkgs/issues/166205. +# This can be dropped once a fix has been committed to cc-wrapper. +// lib.optionalAttrs (stdenv.cc.isClang && stdenv.cc.libcxx != null) { + env.NIX_LDFLAGS = "-l${stdenv.cc.libcxx.cxxabi.libName}"; +} ) )