From 8632aaf71ac5480e66ce36658050651eb2f1450b Mon Sep 17 00:00:00 2001 From: "Ian (Hee) Cha" Date: Thu, 8 Feb 2024 09:25:14 -0800 Subject: [PATCH] [7.1.0] Mark gcc- as `gcc` instead of `compiler` in Unix CC toolchain (#21224) 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. Commit https://github.com/bazelbuild/bazel/commit/88771830d92a93027ed7dfb5d130b3311400dbc4 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 00927dd2728418..b290989d4724ac 100644 --- a/MODULE.bazel.lock +++ b/MODULE.bazel.lock @@ -2293,7 +2293,7 @@ "general": { "bzlTransitiveDigest": "TaEUQXsOyJBUS1hp5pqPajfzBJlceug58PemF8nCEa8=", "accumulatedFileDigests": { - "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "0398b2a48c58023e0736fcb5b0937f39a3a95b4ed34941f482deb898ca3d21e1", + "@@//src/test/tools/bzlmod:MODULE.bazel.lock": "c61fe9fb628aaae087bfa754fc5d1f7a7d19b0d5debaf9bf84eb37fc1a365e71", "@@//:MODULE.bazel": "f0f6c040c50ad1d3555157b29dea32260bdaf5cc7205dfc346d4b1b6b008baca" }, "envVariables": {}, diff --git a/src/test/tools/bzlmod/MODULE.bazel.lock b/src/test/tools/bzlmod/MODULE.bazel.lock index 7b3d08135fdfed..58783496a694af 100644 --- a/src/test/tools/bzlmod/MODULE.bazel.lock +++ b/src/test/tools/bzlmod/MODULE.bazel.lock @@ -1002,7 +1002,7 @@ }, "@@bazel_tools//tools/cpp:cc_configure.bzl%cc_configure_extension": { "general": { - "bzlTransitiveDigest": "mcsWHq3xORJexV5/4eCvNOLxFOQKV6eli3fkr+tEaqE=", + "bzlTransitiveDigest": "PHpT2yqMGms2U4L3E/aZ+WcQalmZWm+ILdP3yiLsDhA=", "accumulatedFileDigests": {}, "envVariables": {}, "generatedRepoSpecs": { diff --git a/tools/cpp/unix_cc_configure.bzl b/tools/cpp/unix_cc_configure.bzl index 5e7b3b79f427c9..ca8c1ba8ff7763 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):