summary refs log tree commit diff
path: root/pkgs/development/compilers/crystal/default.nix
diff options
context:
space:
mode:
authorRandy Eckenrode <randy@largeandhighquality.com>2023-10-21 16:34:23 -0400
committerRandy Eckenrode <randy@largeandhighquality.com>2023-10-22 20:55:37 -0400
commit2ce46f4fc0f23085421d43e2ff26c33fe9d35568 (patch)
tree71e564d8fb81a3d7533ae28fe5bc99284bb2d21e /pkgs/development/compilers/crystal/default.nix
parentb9e9e443a9e65726388ea4d6e74e1535cdfd8e8e (diff)
downloadnixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.tar
nixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.tar.gz
nixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.tar.bz2
nixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.tar.lz
nixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.tar.xz
nixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.tar.zst
nixpkgs-2ce46f4fc0f23085421d43e2ff26c33fe9d35568.zip
crystal: fix build with newer versions of clang
Crystal requires linking libc++abi when building with newer versions of
clang. See https://github.com/NixOS/nixpkgs/issues/166205.
Diffstat (limited to 'pkgs/development/compilers/crystal/default.nix')
-rw-r--r--pkgs/development/compilers/crystal/default.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/development/compilers/crystal/default.nix b/pkgs/development/compilers/crystal/default.nix
index 022c4e54312..c9ffed829b2 100644
--- a/pkgs/development/compilers/crystal/default.nix
+++ b/pkgs/development/compilers/crystal/default.nix
@@ -148,6 +148,11 @@ let
         # See https://github.com/NixOS/nixpkgs/pull/195606#issuecomment-1356491277
         substituteInPlace spec/compiler/loader/unix_spec.cr \
           --replace 'it "parses file paths"' 'pending "parses file paths"'
+      '' + lib.optionalString (stdenv.cc.isClang && (stdenv.cc.libcxx != null)) ''
+        # Darwin links against libc++ not libstdc++. Newer versions of clang (12+) require
+        # libc++abi to be linked explicitly (see https://github.com/NixOS/nixpkgs/issues/166205).
+        substituteInPlace src/llvm/lib_llvm.cr \
+          --replace '@[Link("stdc++")]' '@[Link("c++", "-l${stdenv.cc.libcxx.cxxabi.libName}")]'
       '';
 
       # Defaults are 4