Skip to content

Commit

Permalink
cc_configure: Add -B to compiler flag too
Browse files Browse the repository at this point in the history
On some target platform gcc invokes external tools during compilation, see #1152. Also support absolute path when looking for gcc.

This needs to be cherry-picked to fix #1177.

--
MOS_MIGRATED_REVID=120581887
  • Loading branch information
damienmg committed Apr 22, 2016
1 parent 3c76adc commit ee6fa60
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tools/cpp/cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ def _crosstool_content(repository_ctx, cc, cpu_value, darwin):
# Enable a few more warnings that aren't part of -Wall.
] + (["-Wthread-safety", "-Wself-assign"] if darwin else [
# Disable some that are problematic.
"-Wl,-z,-relro,-z,now"
"-Wl,-z,-relro,-z,now",
"-B" + str(repository_ctx.path(cc).dirname),
# Always have -B/usr/bin, see https://github.com/bazelbuild/bazel/issues/760.
"-B/usr/bin",
]) + (
_add_option_if_supported(repository_ctx, cc, "-Wunused-but-set-parameter") +
# has false positives
Expand Down Expand Up @@ -264,6 +267,9 @@ def _find_cc(repository_ctx):
cc_name = "gcc"
if "CC" in repository_ctx.os.environ:
cc_name = repository_ctx.os.environ["CC"]
if cc_name.startswith("/"):
# Absolute path, maybe we should make this suported by our which function.
return cc_name
cc = repository_ctx.which(cc_name)
if cc == None:
fail(
Expand Down

0 comments on commit ee6fa60

Please sign in to comment.