From 88771830d92a93027ed7dfb5d130b3311400dbc4 Mon Sep 17 00:00:00 2001 From: "Ian (Hee) Cha" Date: Mon, 5 Feb 2024 23:02:05 -0800 Subject: [PATCH] Mark gcc- as `gcc` instead of `compiler` in Unix CC toolchain Fixes #17794 I was looking at writing a test for this, but not sure how you'd like me to go about that. Hard-code a gcc, e.g. `gcc-11`, or search the `$PATH` for a `gcc-`? Closes #20350. PiperOrigin-RevId: 604543138 Change-Id: I71ebbac77e4e32ebc5d99ec4a81415727af12cbc --- MODULE.bazel.lock | 2 +- src/test/tools/bzlmod/MODULE.bazel.lock | 2 +- tools/cpp/unix_cc_configure.bzl | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock index 40fcb6685eaa8a..eb5261d13ead5c 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -2741,7 +2741,7 @@ "general": { "bzlTransitiveDigest": "wiyY30lgHvAgghminN0h4lxMWexDIg/6r/+eOIA5bPU=", "accumulatedFileDigests": { - "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "8aaa38735a99ea2c74e3e0d0eb02dbacd1ebb0fc4bf1a96f9b584496371b16c3", + "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "ce05b19e5797eeb041153a783455ae7b822676eb25c1e813f7e1f65c389920b0", "@@//:MODULE.bazel": "4d4b578dd607ef6ca79369c6c5d896c09e9aaa0fa4787f7865333fb2303d5b70" }, "envVariables": {}, diff --git a/src/test/tools/bzlmod/MODULE.bazel.lock b/src/test/tools/bzlmod/MODULE.bazel.lock index 3bd248975028a0..84c1cef7f5e62e 100644 --- a/src/test/tools/bzlmod/MODULE.bazel.lock +++ b/src/test/tools/bzlmod/MODULE.bazel.lock @@ -1004,7 +1004,7 @@ }, "@@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { "general": { - "bzlTransitiveDigest": "2LC5INJ/KSraqEsbNl9rSibnM7ApBho21h1gyUQbjPg=", + "bzlTransitiveDigest": "R+z/o9z6DUWAxJKuQZet/vuZ78BjspYvMfHxTQ3VEb4=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl index 993e46dd40fb92..67ee079281b751 100644 --- a/tools/cpp/unix_cc_configure.bzl +++ b/tools/cpp/unix_cc_configure.bzl @@ -272,7 +272,8 @@ def _is_clang(repository_ctx, cc): 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 - return repository_ctx.execute([cc, "--version"]).stdout.startswith("gcc ") + cc_stdout = repository_ctx.execute([cc, "--version"]).stdout + return cc_stdout.startswith("gcc ") or cc_stdout.startswith("gcc-") def _get_compiler_name(repository_ctx, cc): if _is_clang(repository_ctx, cc):