Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always set --no-canonical-prefixes if we can #7316

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions tools/cpp/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,21 @@ def _get_no_canonical_prefixes_opt(repository_ctx, cc):
# (ie when they're shorter), it confuses Bazel's logic for verifying all
# #included header files are listed as inputs to the action.

# 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.
# The '-fno-canonical-system-headers' flag is enough in some
# cases, but clang does not support it, and gcc can be configured
# in a way where it is not sufficient to suppress symlink
# resolution, so we also try '-no-canonical-prefixes' if the
# compiler can use it without failing.
opt = _add_compiler_option_if_supported(
repository_ctx,
cc,
"-fno-canonical-system-headers",
)
if len(opt) == 0:
return _add_compiler_option_if_supported(
opt.extend(_add_compiler_option_if_supported(
repository_ctx,
cc,
"-no-canonical-prefixes",
)
))
return opt

def get_env(repository_ctx):
Expand Down