Skip to content

Commit

Permalink
haskell-modules/generic-builder.nix: work around libc++abi issue
Browse files Browse the repository at this point in the history
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 #166205.
  • Loading branch information
reckenrode committed Nov 9, 2023
1 parent 263a89f commit 8164b19
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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}";
}
)
)

0 comments on commit 8164b19

Please sign in to comment.