-
Notifications
You must be signed in to change notification settings - Fork 259
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
Wrong diagnostics on macOS w/ clang10 #622
Comments
same problem |
Same, and I can confirm that I'm setting the resourcesDir in my ccls initializer options. Check #611 For me this also occurs since the latest homebrew update. |
It might be a weird interaction in the homebrew version of things. I managed to build a version using the official llvm release that runs without issues. If anyone needs a workaround for now:
this will open a terminal in a temp directory that allows you to "manually" compile and install ccls within homebrew. In there I ran
pointing cmake directly to the official llvm release (make sure the install prefix points to the right directory, homebrew will tell you where it expects the installed files). Then you just do
And homebrew automatically links ccls if you've installed it to the right directory. |
@flanggut, sorry if this is a stupid question, but did you try this with the homebrew version of llvm? |
That was the first thing I tried, unfortunately it didn't work for me :/ |
Weird. Could there be a problem with the packaging of llvm for homebrew? |
Maybe, I haven't looked into how the homebrew version of llvm is built. |
I'm having a similar issue. Running MacOS Catalina with Apple clang version 11.0.3 |
@flanggut Thank you! This workaround resolves my issue in #191 (comment) I believe you are right that this is a version issue with homebrew. The problems I experienced happened after no changes to configuration, only version upgrades. I'm not even sure what a proper fix for this type of issue looks like, it genuinely might be an issue with homebrew llvm |
I think this is related -- I'm having a similar issue finding Arduino.h (installed via Platform.io): I have I have not tried the workaround posted above, but I'll give it a go when I have some time. |
@flanggut Thank you so much, been stuck on this for hours. Works like a charm! However I had the problem mentioned here. So I had to add For people with similar problems: You can find your linker version via This oneliner should do the trick:
|
Yup. Same issue here. Confirmed on macOS cataline 10.15.5 and clang 11.0.3 with the |
@cweagans what works for me is using the |
Same issue.. @flanggut Thanks, only your solution works for me 👍 |
flanggut's solution works! In this case, whenever there is a new version of ccls, do I have to recompile everything? Thanks! |
I tried most of the workarounds listed in the various issues linked here and cross-linked to each-other.
The part that did it for me was to remove all spaces between '-isystem' and the path. |
I am no expert on either MacOS or on the .ccls file format: I don't use the former and struggle to understand the details of the latter (I wish it could be replaced with a more standard format such as JSON or similar). However, I'm pretty sure that the .ccls file requires each argument to be on its own line in the file. If you write this:
in .ccls, or if you add this to your compile_commands.json file:
that is the same thing as passing arguments like this to clang:
(note the quotes here). If you check the clang docs the format for the
Basically, you're adding the directory You can either remove the space as @Shirk did, or you can put each argument on a separate line / in a separate argument. For .ccls it would be:
and for compile_commands.json it would be something like:
|
Note I can't explain why it works with some versions of clang and not with others: there may be two different issues that are being conflated, or else maybe clang's command line option parser changed to become more strict about whitespace. |
Just wanted to provide an update: on macOS Big Sur 11.1, I finally have it working without needing @flanggut's solution (though that solution did save me for the last 9 months). |
On MacOS Big Sur 11.4, I meet the similar issue. |
Ok, @flanggut 's method works for me: brew uninstall ccls
brew install ccls --HEAD -i A local compilation will work well. |
I am having the same issue on macOS Big Sur 11.6 but when I try @flanggut 's method I encounter the following error during the
I am using Edit: |
https://github.com/MaskRay/ccls/wiki/Build#macos this works for me on arm64 macOS. #!/bin/sh
exec /opt/homebrew/bin/ccls --init='{"clang":{"extraArgs":[
"-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c /v1",
"-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/include",
"-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include",
"-isystem/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
"-isystem/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks"
]}}' "$@" |
Hi, I have an Intel machine with Big Sur and I am using
More concretely, if I do #include <Eigen/Dense> I see Here is also my [
{
"directory": "/Users/eagomez/Desktop/project/build",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c -I/usr/local/include -I/Users/eagomez/Desktop/project/source/include -isystem /usr/local/include/eigen3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -std=gnu 2a -o CMakeFiles/CPPTest.dir/main.cpp.o -c /Users/eagomez/Desktop/project/source/main.cpp",
"file": "/Users/eagomez/Desktop/project/source/main.cpp"
},
{
"directory": "/Users/eagomez/Desktop/project/build",
"command": "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c -I/usr/local/include -I/Users/eagomez/Desktop/project/source/include -isystem /usr/local/include/eigen3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk -std=gnu 2a -o CMakeFiles/CPPTest.dir/include/ETL.cpp.o -c /Users/eagomez/Desktop/project/source/include/ETL.cpp",
"file": "/Users/eagomez/Desktop/project/source/include/ETL.cpp"
}
] Thanks for your help! |
Observed behavior
compile_commands.json
main.cpp
ccls --index=. -v=2
Correctly identifies and and indexes all headers.
File compiles without issues.
In my editor ccls claims that
<chrono>
include cannot be found under./chrono
, note that the error is always shown for the include path-I.
, if I change that to-I..
the error will show that../chrono
cannot be found.This only happens since clang/llvm10 and does not happen if I compile ccls against clang/llvm9.
Expected behavior
No diagnostics should be shown in an editor.
Steps to reproduce
brew install ccls
(recently updated to use llvm10)System information
git describe --tags --long
):brew info ccls
The text was updated successfully, but these errors were encountered: