-
Notifications
You must be signed in to change notification settings - Fork 328
CLion: Only forward builtin includes from a custom sysroot #7667
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
Conversation
This change requires further investigation, why does Bazel report both include directories? What if toolchain actually does define include paths that are not in the sysroot and cannot be discovered by CLion? |
As far as I understand the issue here is caused by a bug in rules_cc. Maybe we should not forward all include paths reported by rules_cc since they have proven to be unreliable and instead relay on CLions compiler info collection. But not sure yet how to filter the include paths reported by rules_cc. |
// includes can lead to headers being resolved into the wrong include directory. | ||
final var sysroot = compilerSettings.getSysroot(); | ||
if (sysroot != null) { | ||
compilerSettings.getBuiltInIncludes().stream() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's revise this PR and consider doing this with registry key. I'm unsure if this change as is would lead to some unresolved headers etc, this has to be validated with custom toolchain with sysroot.
# Conflicts: # clwb/BUILD
…tests # Conflicts: # cpp/src/com/google/idea/blaze/cpp/BlazeCWorkspace.java
Discussion thread for this change
Issue number: #7489
Description of this change
Builtin includes reported by the CcToolchainInfo provider sometimes contain include paths for both libc++ and libstdc++ regardless of what compiler options are specified. CLion is able to find the right include path during compiler info collection automatically. But if both include paths are manually added to the switch builder CLion might select the wrong one after all.
Therefore, only forward builtin includes which point into a custom sysroot and let CLion detect the correct builtin includes during compiler info collection.