From d7abe3badad3df08e99ee63f11c8b9be62c57101 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 14 Oct 2014 16:53:48 +0200 Subject: [PATCH] libc++abi: Enable _LIBCXX_DYNAMIC_FALLBACK Without this, the C++ dynamic_cast<> operator does not work reliably in conjunction with dynamic linking. See http://www.russellmcc.com/posts/2013-08-03-rtti.html (That article suggests that Apple builds libc++abi without _LIBCXX_DYNAMIC_FALLBACK, but "strings /usr/lib/libc++abi.dylib" shows that it *is* enabled.) --- pkgs/development/libraries/libc++abi/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libc++abi/default.nix b/pkgs/development/libraries/libc++abi/default.nix index d5b8b0fcdcea..ec87254c170c 100644 --- a/pkgs/development/libraries/libc++abi/default.nix +++ b/pkgs/development/libraries/libc++abi/default.nix @@ -16,9 +16,11 @@ stdenv.mkDerivation { postUnpack = '' unpackFile ${libcxx.src} - export NIX_CFLAGS_COMPILE="-I$PWD/include -I$(readlink -f libcxx-*)/include" '' + lib.optionalString stdenv.isDarwin '' export TRIPLE=x86_64-apple-darwin + # Hack: NIX_CFLAGS_COMPILE doesn't work here because clang++ isn't + # wrapped at this point. + export CXX="clang++ -D_LIBCXX_DYNAMIC_FALLBACK=1" ''; installPhase = if stdenv.isDarwin