Skip to content
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
8 changes: 7 additions & 1 deletion cc/private/toolchain/unix_cc_configure.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ def _is_gcc(repository_ctx, cc):
# GCC's version output uses the basename of argv[0] as the program name:
# https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/gcc.cc;h=158461167951c1b9540322fb19be6a89d6da07fc;hb=HEAD#l8728
cc_stdout = repository_ctx.execute([cc, "--version"]).stdout
return cc_stdout.startswith("gcc ") or cc_stdout.startswith("gcc-")
if cc_stdout.startswith("gcc ") or cc_stdout.startswith("gcc-"):
return True

# As a fallback, also check specs output in case argv[0] was a symlink.
specs = repository_ctx.execute([cc, "-v"]).stderr
last_line = specs.rstrip("\n").split("\n")[-1]
return "gcc version " in last_line

def _get_compiler_name(repository_ctx, cc):
if _is_clang(repository_ctx, cc):
Expand Down