bazel: Update for use with Fujitsu compiler (#16860)

* bazel: Update for use with Fujitsu compiler

* bazel: Fix for use with Fujitsu compiler

* bazel: Fix flake8 error

* bazel: add conflicts setting for use with Fujitsu compiler

* fix flake8 error

* fix flake8 error
This commit is contained in:
takanori-ihara 2020-06-17 12:18:04 +09:00 committed by GitHub
parent 84e117b497
commit b0c73c3325
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 0 deletions

View File

@ -130,6 +130,16 @@ class Bazel(Package):
patch('compile-0.4.patch', when='@0.4:0.5')
patch('compile-0.3.patch', when='@:0.3')
# for fcc
patch('patch_for_fcc.patch', when='@0.29.1:%fj')
patch('patch_for_fcc2.patch', when='@0.25:%fj')
conflicts(
'%fj',
when='@:0.24.1',
msg='Fujitsu Compiler cannot build 0.24.1 or less, '
'please use a newer release.'
)
patch('disabledepcheck.patch', when='@0.3.2:+nodepfail')
patch('disabledepcheck_old.patch', when='@0.3.0:0.3.1+nodepfail')
@ -201,3 +211,7 @@ def test(self):
def setup_dependent_package(self, module, dependent_spec):
module.bazel = Executable('bazel')
@property
def parallel(self):
return not self.spec.satisfies('%fj')

View File

@ -0,0 +1,37 @@
diff --git a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc
index 87ba899180..1c967ee818 100644
--- a/src/main/cpp/blaze_util_posix.cc
+++ b/src/main/cpp/blaze_util_posix.cc
@@ -565,7 +565,8 @@ static int setlk(int fd, struct flock *lock) {
// Prefer OFD locks if available. POSIX locks can be lost "accidentally"
// due to any close() on the lock file, and are not reliably preserved
// across execve() on Linux, which we need for --batch mode.
- if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
+ //if (fcntl(fd, F_OFD_SETLK, lock) == 0) return 0;
+ if (fcntl(fd, F_SETLK, lock) == 0) return 0;
if (errno != EINVAL) {
if (errno != EACCES && errno != EAGAIN) {
BAZEL_DIE(blaze_exit_code::LOCAL_ENVIRONMENTAL_ERROR)
diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl
index ccb18a431a..0c5c8fd6f0 100644
--- a/tools/cpp/unix_cc_configure.bzl
+++ b/tools/cpp/unix_cc_configure.bzl
@@ -379,7 +379,8 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
"",
False,
), ":")
- gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
+ #gold_linker_path = _find_gold_linker_path(repository_ctx, cc)
+ gold_linker_path = None
cc_path = repository_ctx.path(cc)
if not str(cc_path).startswith(str(repository_ctx.path(".")) + "/"):
# cc is outside the repository, set -B
@@ -468,7 +469,7 @@ def configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools):
# Security hardening requires optimization.
# We need to undef it as some distributions now have it enabled by default.
"-U_FORTIFY_SOURCE",
- "-fstack-protector",
+ #"-fstack-protector",
# All warnings are enabled. Maybe enable -Werror as well?
"-Wall",
# Enable a few more warnings that aren't part of -Wall.

View File

@ -0,0 +1,11 @@
--- a/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/rules/BazelRuleClassProvider.java
@@ -185,7 +185,7 @@ public class BazelRuleClassProvider {
Map<String, String> spackEnv = System.getenv();
for (String envName : spackEnv.keySet()) {
- if (envName.startsWith("SPACK_")) {
+ if ((envName.startsWith("SPACK_")) || (envName.equals("fcc_ENV")) || (envName.equals("FCC_ENV"))) {
env.put(envName, spackEnv.get(envName));
}
}