-
Notifications
You must be signed in to change notification settings - Fork 303
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
Header Search Paths Broken #2285
Comments
Okay, figured out the real issue with the plugin causing this problem. The problem is this plugin wraps clang in a shell script without properly configuring the code-completion system to understand the wrapping. Then, clangd, which Android Studio (and Jetbrains stuff more generally) uses for C-language-family autocomplete, can't introspect that compiler driver well enough to provide autocomplete. You can make things work by just disabling the wrapper. Fastest way is to just set the compiler to cppExecutable in the following line. I patched my plugin with that change and everything works correctly. intellij/cpp/src/com/google/idea/blaze/cpp/BlazeConfigurationToolchainResolver.java Line 272 in 3938f30
If the blaze_compiler.sh wrapper is important and shouldn't be bypassed, passing the wrapped compiler shell script to to JetBrains's bundled clangd via the --query-driver flag should also do the trick. Not sure if there's a way to do that in the plugin API...I definitely didn't see one in the Android Studio settings GUI. |
See bazelbuild#2285. Temporary workaround; a real fix should remove the compilerWrapper, use query-driver, or do something more elegant.
Update: Because I needed this change--and some others--to make the the plugin run, I made a temporary fork. While we're waiting for an official response, check it out if you want this workaround (and others). https://github.com/hedronvision/bazelbuild-intellij |
See bazelbuild#2285. Temporary workaround; a real fix should remove the compilerWrapper, use query-driver, or do something more elegant.
@cpsauer Thank you so much for the fork! It's working great. Fixes so many of the issues I had with the original plugin. |
Glad to hear it! You're very welcome, @physxP! |
Summary: Plugin seems to provide no header search paths to the editor, breaking #include and autocomplete for C++.
Symptoms:
Suspected Causes
The plugin seems to be failing to set any "Header Search paths".
Running "Show Compiler Info" (via Help->Find Action) shows an empty list of "Header Search paths" for all files examined.
"Compiler switches" contains isystem/iquote flags for all the correct directories, but that doesn't seem to be enough.
I think I can see where the switches--but not the search paths--are set in BlazeCWorkspace.java.
Platform details that shouldn't matter, but I'll include for completeness:
Latest released Android Studio, 4.1.1.
Using a working version of the plugin, patched as in #2265
Latest macOS, 11.1.
Latest Bazel, 3.7.2
Build setup is Android Library that depends on cc_libraries.
Related to, but not the same as #330, since the switches are not null.
Thanks!
Chris
(ex-Googler)
P.S. If, in the meantime, anyone knows a workaround for overriding the header search paths and adding them, I'd love to hear it. This is the last major bug we don't have a workaround for.
The text was updated successfully, but these errors were encountered: