summaryrefslogtreecommitdiffstats
path: root/pkgs
diff options
context:
space:
mode:
authorThibault Gagnaux <thibault@gagnaux.ch>2020-10-07 19:46:01 +0200
committerThibault Gagnaux <thibault@gagnaux.ch>2020-10-10 15:46:17 +0200
commitf7aafe6345f6d2fa5db8d6b23f7cf9315d73f67d (patch)
treeb24088942dfa1ce0213dfe9a36a274c7b429fdd2 /pkgs
parent00e3a3a8552f844a82ddb56a9e96675bbea07739 (diff)
bazel_1: fix build on darwin
Use clang_8 instead of clang_7 on darwin to fix thread_local storage error.
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/build-managers/bazel/bazel_1/default.nix22
1 files changed, 12 insertions, 10 deletions
diff --git a/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix b/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix
index 8dcdc71415fa..5eb0926503c8 100644
--- a/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix
+++ b/pkgs/development/tools/build-managers/bazel/bazel_1/default.nix
@@ -7,7 +7,7 @@
# updater
, python27, python3, writeScript
# Apple dependencies
-, cctools, libcxx, CoreFoundation, CoreServices, Foundation
+, cctools, llvmPackages_8, CoreFoundation, CoreServices, Foundation
# Allow to independently override the jdks used to build and run respectively
, buildJdk, runJdk
, buildJdkName
@@ -139,8 +139,10 @@ let
'';
};
+ stdenv' = if stdenv.isDarwin then llvmPackages_8.libcxxStdenv else stdenv;
+
in
-stdenv.mkDerivation rec {
+stdenv'.mkDerivation rec {
pname = "bazel";
inherit version;
@@ -348,10 +350,10 @@ stdenv.mkDerivation rec {
# libcxx includes aren't added by libcxx hook
# https://github.com/NixOS/nixpkgs/pull/41589
- export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${libcxx}/include/c++/v1"
+ export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -isystem ${llvmPackages_8.libcxx}/include/c++/v1"
# don't use system installed Xcode to run clang, use Nix clang instead
- sed -i -E "s;/usr/bin/xcrun (--sdk macosx )?clang;${stdenv.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
+ sed -i -E "s;/usr/bin/xcrun --sdk macosx clang -mmacosx-version-min=10.9;${stdenv'.cc}/bin/clang $NIX_CFLAGS_COMPILE $(bazelLinkFlags) -framework CoreFoundation;g" \
scripts/bootstrap/compile.sh \
src/tools/xcode/realpath/BUILD \
src/tools/xcode/stdredirect/BUILD \
@@ -380,7 +382,7 @@ stdenv.mkDerivation rec {
substituteInPlace tools/objc/j2objc_dead_code_pruner.py --replace "$!/usr/bin/python2.7" "#!${python27}/bin/python"
# md5sum is part of coreutils
- sed -i 's|/sbin/md5|md5sum|' \
+ sed -i 's|/sbin/md5|md5sum|g' \
src/BUILD
# substituteInPlace is rather slow, so prefilter the files with grep
@@ -417,8 +419,8 @@ stdenv.mkDerivation rec {
fetch --distdir=${distDir}
build --copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt="/g')"
build --host_copt="$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt="/g')"
- build --linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
- build --host_linkopt="$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
+ build --linkopt="$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt="/g')"
+ build --host_linkopt="$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt="/g')"
build --linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt="-Wl,/g')"
build --host_linkopt="-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt="-Wl,/g')"
build --host_javabase='@local_jdk//:jdk'
@@ -428,8 +430,8 @@ stdenv.mkDerivation rec {
# add the same environment vars to compile.sh
sed -e "/\$command \\\\$/a --copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --copt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --host_copt=\"$(echo $NIX_CFLAGS_COMPILE | sed -e 's/ /" --host_copt=\"/g')\" \\\\" \
- -e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
- -e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
+ -e "/\$command \\\\$/a --linkopt=\"$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --linkopt=\"/g')\" \\\\" \
+ -e "/\$command \\\\$/a --host_linkopt=\"$(echo $(< ${stdenv'.cc}/nix-support/libcxx-ldflags) | sed -e 's/ /" --host_linkopt=\"/g')\" \\\\" \
-e "/\$command \\\\$/a --linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_linkopt=\"-Wl,$(echo $NIX_LDFLAGS | sed -e 's/ /" --host_linkopt=\"-Wl,/g')\" \\\\" \
-e "/\$command \\\\$/a --host_javabase='@local_jdk//:jdk' \\\\" \
@@ -469,7 +471,7 @@ stdenv.mkDerivation rec {
makeWrapper
which
customBash
- ] ++ lib.optionals (stdenv.isDarwin) [ cctools libcxx CoreFoundation CoreServices Foundation ];
+ ] ++ lib.optionals (stdenv.isDarwin) [ cctools CoreFoundation CoreServices Foundation ];
# Bazel makes extensive use of symlinks in the WORKSPACE.
# This causes problems with infinite symlinks if the build output is in the same location as the