Skip to content

Commit

Permalink
cc_configure: uses which on the CC environment variable
Browse files Browse the repository at this point in the history
It's wrong to assume it points to an absolute path.

Discovered in issue #1152.

--
MOS_MIGRATED_REVID=120242469
  • Loading branch information
damienmg committed Apr 20, 2016
1 parent 4bb63d9 commit 3e4e416
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tools/cpp/cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -261,15 +261,15 @@ def _dbg_content():

def _find_cc(repository_ctx):
"""Find the C++ compiler."""
cc_name = "gcc"
if "CC" in repository_ctx.os.environ:
return repository_ctx.path(repository_ctx.os.environ["CC"])
else:
cc = repository_ctx.which("gcc")
if cc == None:
fail(
"Cannot find gcc, either correct your path or set the CC" +
" ennvironment variable")
return cc
cc_name = repository_ctx.os.environ["CC"]
cc = repository_ctx.which(cc_name)
if cc == None:
fail(
"Cannot find gcc, either correct your path or set the CC" +
" environment variable")
return cc


def _tpl(repository_ctx, tpl, substitutions={}):
Expand Down

0 comments on commit 3e4e416

Please sign in to comment.