Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@bazel_tools//tools/cpp:compiler:gcc detection does not handle gcc-10 #17794

Closed
jbms opened this issue Mar 15, 2023 · 2 comments
Closed

@bazel_tools//tools/cpp:compiler:gcc detection does not handle gcc-10 #17794

jbms opened this issue Mar 15, 2023 · 2 comments
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: bug

Comments

@jbms
Copy link

jbms commented Mar 15, 2023

Description of the bug:

Bazel's detection of GCC only works if the compiler executable name is exactly "gcc":

def _is_gcc(repository_ctx, cc):

Consequently, it fails to detect common variations like gcc-10 as GCC.

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

CC=gcc-10 bazel ...

Which operating system are you running Bazel on?

Linux

What is the output of bazel info release?

release 6.1.0

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

@fmeum
Copy link
Collaborator

fmeum commented Mar 15, 2023

I simply didn't consider this case when I submitted ef3f058. Happy to (pre-)review a PR.

copybara-service bot pushed a commit to google/tensorstore that referenced this issue Mar 15, 2023
Previously, due to bazelbuild/bazel#17794,
if gcc was specified as `CC=gcc-10` it was not properly detected as
GCC, leading to build errors from missing flags.

With this fix, an unknown compiler is assumed to be GCC.

PiperOrigin-RevId: 516947056
Change-Id: Ib3c4baa4d7302f2c136b4b61af25d4e3321ef6df
@buildbreaker2021 buildbreaker2021 added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Mar 21, 2023
robinlinden added a commit to robinlinden/bazel that referenced this issue Nov 29, 2023
Previously only gcc-binaries named exactly `gcc` were marked as `gcc`,
with the others being marked as `compiler`.

Fixes bazelbuild#17794
robinlinden added a commit to robinlinden/bazel that referenced this issue Nov 29, 2023
Previously only gcc-binaries named exactly `gcc` were marked as `gcc`,
with the others being marked as `compiler`.

Fixes bazelbuild#17794
robinlinden added a commit to robinlinden/bazel that referenced this issue Dec 28, 2023
Previously only gcc-binaries named exactly `gcc` were marked as `gcc`,
with the others being marked as `compiler`.

Fixes bazelbuild#17794
iancha1992 added a commit to iancha1992/bazel that referenced this issue Feb 6, 2024
Fixes bazelbuild#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-<version>`?

Closes bazelbuild#20350.

PiperOrigin-RevId: 604543138
Change-Id: I71ebbac77e4e32ebc5d99ec4a81415727af12cbc
github-merge-queue bot pushed a commit that referenced this issue Feb 8, 2024
…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-<version>`?
    
Closes #20350.

Commit
8877183
    
PiperOrigin-RevId: 604543138
Change-Id: I71ebbac77e4e32ebc5d99ec4a81415727af12cbc
@iancha1992
Copy link
Member

A fix for this issue has been included in Bazel 7.1.0 RC1. Please test out the release candidate and report any issues as soon as possible. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 We're not considering working on this, but happy to review a PR. (No assignee) team-Rules-CPP Issues for C++ rules type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants