@@ -181,6 +181,14 @@ stdenv.mkDerivation rec {
181181 # argument if it's found to be an empty string.
182182 ../trim-last-argument-to-gcc-if-empty.patch
183183
184+ # On Darwin, using clang 6 to build fails because of a linker error (see #105573),
185+ # but using clang 7 fails because libarclite_macosx.a cannot be found when linking
186+ # the xcode_locator tool.
187+ # This patch removes using the -fobjc-arc compiler option and makes the code
188+ # compile without automatic reference counting. Caveat: this leaks memory, but
189+ # we accept this fact because xcode_locator is only a short-lived process used during the build.
190+ ./no-arc.patch
191+
184192 # --experimental_strict_action_env (which may one day become the default
185193 # see bazelbuild/bazel#2574) hardcodes the default
186194 # action environment to a non hermetic value (e.g. "/usr/local/bin").
@@ -389,6 +397,8 @@ stdenv.mkDerivation rec {
389397 src/tools/xcode/stdredirect/BUILD \
390398 tools/osx/BUILD
391399
400+ substituteInPlace scripts/bootstrap/compile.sh --replace ' -mmacosx-version-min=10.9' ""
401+
392402 # nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead
393403 sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
394404