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

Mark gcc as gcc instead of compiler in Unix CC toolchain #16297

Closed
wants to merge 1 commit into from

Conversation

fmeum
Copy link
Collaborator

@fmeum fmeum commented Sep 19, 2022

This makes it possible to detect gcc specifically via a config_setting for the @bazel_tools//tools/cpp:compiler flag with value gcc.

RELNOTES: The @bazel_tools//tools/cpp:compiler flag now has the value gcc if the configured compiler is detected to be gcc rather than the generic value compiler. A branch for gcc may have to be added to select statements that do not have a default case that handles gcc appropriately.

Fixes #12707

@fmeum fmeum changed the title Mark gcc as gcc instead of compiler in Unix CC toolchain Mark gcc as gcc instead of compiler in Unix CC toolchain Sep 19, 2022
@fmeum fmeum force-pushed the 12707-detect-gcc branch 5 times, most recently from 363d121 to a943d9e Compare September 19, 2022 10:44
This makes it possible to detect `gcc` specifically via a
`config_setting` for the `@bazel_tools//tools/cpp:compiler` flag with
value `gcc`.

RELNOTES: The `@bazel_tools//tools/cpp:compiler` flag now has the value
`gcc` if the configured compiler is detected to be gcc rather than the
generic value `compiler`. A branch for `gcc` may have to be added to
`select` statements that do not have a default case that handles gcc
appropriately.
@fmeum fmeum marked this pull request as ready for review September 19, 2022 12:09
@fmeum
Copy link
Collaborator Author

fmeum commented Sep 19, 2022

@oquenchil Would you be available to review this?

@buildbreaker2021 buildbreaker2021 added the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Sep 19, 2022
}

function test_compiler_flag_clang() {
# TODO: The default toolchain always uses XCode's clang, but sets the compiler name to the generic
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you force using the C++ only toolchain on macOS this would likely pass, although maybe it still shouldn't

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly went over the control flow and it seemed as if the fallback to the Unix toolchain would only be picked if Xcode couldn't be find. I have a follow-up PR where I will dig deeper into the macOS case.

@sgowroji sgowroji added the team-Rules-CPP Issues for C++ rules label Sep 20, 2022
@sgowroji sgowroji removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Sep 20, 2022
@fmeum fmeum deleted the 12707-detect-gcc branch September 20, 2022 06:08
aiuto pushed a commit to aiuto/bazel that referenced this pull request Oct 12, 2022
This makes it possible to detect gcc specifically via a `config_setting` for the `@bazel_tools//tools/cpp:compiler` flag with value `gcc`.

RELNOTES: The `@bazel_tools//tools/cpp:compiler` flag now has the value `gcc` if the configured compiler is detected to be gcc rather than the generic value `compiler`. A branch for `gcc` may have to be added to `select` statements that do not have a default case that handles gcc appropriately.

Fixes bazelbuild#12707

Closes bazelbuild#16297.

PiperOrigin-RevId: 475467838
Change-Id: I9fa98ddd3c7f29742357596280dfc98c939f0253
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-Rules-CPP Issues for C++ rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Constraint value @bazel_tools//tools/cpp:compiler:gcc not true when using GCC compiler
4 participants