lol

bazel: Fix build on darwin

* use default stdenv (clang 7)
* add no-arc.patch to make the xcode_locate tool compile without libarc-lite
* remove the `-mmacosx-version-min=10.9` flag from the bootstrap compile script

+45 -1
+10
pkgs/development/tools/build-managers/bazel/bazel_3/default.nix
··· 176 176 # argument if it's found to be an empty string. 177 177 ../trim-last-argument-to-gcc-if-empty.patch 178 178 179 + # On Darwin, using clang 6 to build fails because of a linker error (see #105573), 180 + # but using clang 7 fails because libarclite_macosx.a cannot be found when linking 181 + # the xcode_locator tool. 182 + # This patch removes using the -fobjc-arc compiler option and makes the code 183 + # compile without automatic reference counting. Caveat: this leaks memory, but 184 + # we neglect this fact. 185 + ./no-arc.patch 186 + 179 187 # --experimental_strict_action_env (which may one day become the default 180 188 # see bazelbuild/bazel#2574) hardcodes the default 181 189 # action environment to a non hermetic value (e.g. "/usr/local/bin"). ··· 370 378 src/tools/xcode/realpath/BUILD \ 371 379 src/tools/xcode/stdredirect/BUILD \ 372 380 tools/osx/BUILD 381 + 382 + substituteInPlace scripts/bootstrap/compile.sh --replace ' -mmacosx-version-min=10.9' "" 373 383 374 384 # nixpkgs's libSystem cannot use pthread headers directly, must import GCD headers instead 375 385 sed -i -e "/#include <pthread\/spawn.h>/i #include <dispatch/dispatch.h>" src/main/cpp/blaze_util_darwin.cc
+34
pkgs/development/tools/build-managers/bazel/bazel_3/no-arc.patch
··· 1 + --- a/tools/osx/xcode_locator.m 2020-12-10 13:27:29.000000000 +0100 2 + +++ b/tools/osx/xcode_locator.m 2021-02-01 09:09:32.159557051 +0100 3 + @@ -21,10 +21,6 @@ 4 + // 6,6.4,6.4.1 = 6.4.1 5 + // 6.3,6.3.0 = 6.3 6 + 7 + -#if !defined(__has_feature) || !__has_feature(objc_arc) 8 + -#error "This file requires ARC support." 9 + -#endif 10 + - 11 + #import <CoreServices/CoreServices.h> 12 + #import <Foundation/Foundation.h> 13 + 14 + --- a/tools/osx/xcode_configure.bzl 1980-01-01 01:00:00.000000000 +0100 15 + +++ b/tools/osx/xcode_configure.bzl 2021-02-01 09:36:57.773418444 +0100 16 + @@ -123,7 +123,6 @@ 17 + "macosx", 18 + "clang", 19 + "-mmacosx-version-min=10.9", 20 + - "-fobjc-arc", 21 + "-framework", 22 + "CoreServices", 23 + "-framework", 24 + --- a/tools/osx/BUILD 2021-02-01 11:01:02.191659553 +0100 25 + +++ b/tools/osx/BUILD 2021-02-01 11:04:29.735071019 +0100 26 + @@ -27,7 +27,7 @@ 27 + ]) 28 + 29 + DARWIN_XCODE_LOCATOR_COMPILE_COMMAND = """ 30 + - /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -fobjc-arc -framework CoreServices \ 31 + + /usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9 -framework CoreServices \ 32 + -framework Foundation -o $@ $< 33 + """ 34 +
+1 -1
pkgs/top-level/all-packages.nix
··· 11680 11680 buildJdk = jdk11_headless; 11681 11681 buildJdkName = "java11"; 11682 11682 runJdk = jdk11_headless; 11683 - stdenv = if stdenv.cc.isClang then llvmPackages_6.stdenv else stdenv; 11683 + stdenv = if stdenv.cc.isClang then llvmPackages.stdenv else stdenv; 11684 11684 bazel_self = bazel_3; 11685 11685 }; 11686 11686