From cefb2343c690746052c9d4701f0ad597b57adaaa Mon Sep 17 00:00:00 2001 From: hlopko Date: Mon, 4 Mar 2019 01:56:51 -0800 Subject: [PATCH] Automated rollback of commit 1b4c37c38804559b5c1ade6f9c93501875e231b0. *** Reason for rollback *** Breaks protobuf when bootstrapping bazel (https://github.com/bazelbuild/bazel/issues/7605) ERROR: /home/bazel/.cache/bazel/_bazel_bazel/ec321eb2cc2d0f8f91b676b6d4c66c29/external/io_bazel/third_party/protobuf/3.6.1/BUILD:123:1: undeclared inclusion(s) in rule '@io_bazel//third_party/protobuf/3.6.1:protobuf_lite': this rule is missing dependency declarations for the following files included by 'external/io_bazel/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.cc': '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/bytestream.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/common.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/port.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/platform_macros.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/macros.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/logging.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/mutex.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/callback.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/stringpiece.h' '/workdir/third_party/protobuf/3.6.1/src/google/protobuf/stubs/hash.h' *** Original change description *** Always set --no-canonical-prefixes if we can -no-canonical-prefixes should be enough in all cases except very old compilers. For those, we keep using -fno-canonical-system-headers Closes #7316. PiperOrigin-RevId: 236613108 --- tools/cpp/unix_cc_configure.bzl | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl index 38db2fc3ac9581..588e33ba398dac 100644 --- a/tools/cpp/unix_cc_configure.bzl +++ b/tools/cpp/unix_cc_configure.bzl @@ -202,21 +202,20 @@ def _get_no_canonical_prefixes_opt(repository_ctx, cc): # If the compiler sometimes rewrites paths in the .d files without symlinks # (ie when they're shorter), it confuses Bazel's logic for verifying all # #included header files are listed as inputs to the action. - # We also rely on symlinks not being resolved for remote builds. - # The '-no-canonical-prefixes' flag is enough in most cases. - # In case this flag is not supported (older gcc versions), we try to add - # '-fno-canonical-system-headers' instead. + # The '-fno-canonical-system-headers' should be enough, but clang does not + # support it, so we also try '-no-canonical-prefixes' if first option does + # not work. opt = _add_compiler_option_if_supported( repository_ctx, cc, - "-no-canonical-prefixes", + "-fno-canonical-system-headers", ) if len(opt) == 0: return _add_compiler_option_if_supported( repository_ctx, cc, - "-fno-canonical-system-headers", + "-no-canonical-prefixes", ) return opt