diff --git a/var/spack/repos/builtin/packages/bazel/linux_ppc-0.29.1.patch b/var/spack/repos/builtin/packages/bazel/linux_ppc-0.29.1.patch new file mode 100644 index 0000000000..c3ed9ab254 --- /dev/null +++ b/var/spack/repos/builtin/packages/bazel/linux_ppc-0.29.1.patch @@ -0,0 +1,61 @@ +From 9c9d27561780bc56d9f0867e325c7421a94ee1cb Mon Sep 17 00:00:00 2001 +From: Harsh Bhatia +Date: Tue, 15 Dec 2020 15:56:10 -0800 +Subject: [PATCH] https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0 + +--- + src/conditions/BUILD | 6 ++++++ + third_party/BUILD | 8 ++++++-- + 2 files changed, 12 insertions(+), 2 deletions(-) + +diff --git a/src/conditions/BUILD b/src/conditions/BUILD +index 2b28e28057..faa41a439d 100644 +--- a/src/conditions/BUILD ++++ b/src/conditions/BUILD +@@ -10,6 +10,12 @@ filegroup( + visibility = ["//src:__pkg__"], + ) + ++config_setting( ++ name = "linux_ppc", ++ values = {"cpu": "ppc"}, ++ visibility = ["//visibility:public"], ++) ++ + config_setting( + name = "linux_x86_64", + values = {"cpu": "k8"}, +diff --git a/third_party/BUILD b/third_party/BUILD +index 159006d741..4fcae54c00 100644 +--- a/third_party/BUILD ++++ b/third_party/BUILD +@@ -523,12 +523,13 @@ UNNECESSARY_DYNAMIC_LIBRARIES = select({ + "//src/conditions:darwin": "*.so *.dll", + "//src/conditions:darwin_x86_64": "*.so *.dll", + "//src/conditions:linux_x86_64": "*.jnilib *.dll", ++ "//src/conditions:linux_ppc": "*.so *.jnilib *.dll", + # The .so file is an x86 one, so we can just remove it if the CPU is not x86 + "//src/conditions:arm": "*.so *.jnilib *.dll", + "//src/conditions:linux_aarch64": "*.so *.jnilib *.dll", + # Play it safe -- better have a big binary than a slow binary + # zip -d does require an argument. Supply something bogus. +- "//conditions:default": "*.bogusextension", ++ "//conditions:default": "", + }) + + # Remove native libraries that are for a platform different from the one we are +@@ -537,7 +538,10 @@ genrule( + name = "filter_netty_dynamic_libs", + srcs = ["netty_tcnative/netty-tcnative-boringssl-static-2.0.24.Final.jar"], + outs = ["netty_tcnative/netty-tcnative-filtered.jar"], +- cmd = "cp $< $@ && zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES, ++ cmd = "cp $< $@ && " + ++ # End successfully if there is nothing to be deleted from the archive ++ "if [ -n '" + UNNECESSARY_DYNAMIC_LIBRARIES + "' ]; then " + ++ "zip -qd $@ " + UNNECESSARY_DYNAMIC_LIBRARIES + "; fi", + ) + + java_import( +-- +2.21.0 (Apple Git-122.2) + diff --git a/var/spack/repos/builtin/packages/bazel/package.py b/var/spack/repos/builtin/packages/bazel/package.py index 2ec348240e..6c1380132b 100644 --- a/var/spack/repos/builtin/packages/bazel/package.py +++ b/var/spack/repos/builtin/packages/bazel/package.py @@ -108,6 +108,11 @@ class Bazel(Package): depends_on('python', type=('build', 'run')) depends_on('zip', when='platform=linux', type=('build', 'run')) + # make work on power9 (2x commits) + # https://github.com/bazelbuild/bazel/commit/5cff4f1edf8b95bf0612791632255852332f72b5 + # https://github.com/bazelbuild/bazel/commit/ab62a6e097590dac5ec946ad7a796ea0e8593ae0 + patch('linux_ppc-0.29.1.patch', when='@0.29.1') + # Pass Spack environment variables to the build patch('bazelruleclassprovider-0.25.patch', when='@0.25:') patch('bazelruleclassprovider-0.14.patch', when='@0.14:0.24') @@ -163,6 +168,11 @@ def url_for_version(self, version): return url.format(version) def setup_build_environment(self, env): + # fix the broken linking (on power9) + # https://github.com/bazelbuild/bazel/issues/10327 + env.set('BAZEL_LINKOPTS', '') + env.set('BAZEL_LINKLIBS', '-lstdc++') + env.set('EXTRA_BAZEL_ARGS', # Spack's logs don't handle colored output well '--color=no --host_javabase=@local_jdk//:jdk'