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.)
This commit is contained in:
Eelco Dolstra 2014-10-14 16:53:48 +02:00
parent 7aacca25df
commit d7abe3bada

View File

@ -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