@@ -325,7 +325,13 @@ stdenv.mkDerivation ({
325325
326326 NIX_LDFLAGS = stdenv.lib.optionalString hostPlatform.isSunOS "-lm -ldl";
327327
328− preConfigure = stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
328+ preConfigure =
329+ # Not sure why this is causing problems, now that the stdenv
330+ # exports CPP=cpp the build fails with strange errors on darwin.
331+ # https://github.com/NixOS/nixpkgs/issues/27889
332+ stdenv.lib.optionalString stdenv.cc.isClang ''
333+ unset CPP
334+ '' + stdenv.lib.optionalString (hostPlatform.isSunOS && hostPlatform.is64bit) ''
329335 export NIX_LDFLAGS=`echo $NIX_LDFLAGS | sed -e s~$prefix/lib~$prefix/lib/amd64~g`
330336 export LDFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $LDFLAGS_FOR_TARGET"
331337 export CXXFLAGS_FOR_TARGET="-Wl,-rpath,$prefix/lib/amd64 $CXXFLAGS_FOR_TARGET"