Skip to content
This repository has been archived by the owner on Sep 17, 2022. It is now read-only.

Libclang does not find its include directory on Linux #52

Open
IngoMeyer441 opened this issue May 31, 2018 · 2 comments
Open

Libclang does not find its include directory on Linux #52

IngoMeyer441 opened this issue May 31, 2018 · 2 comments

Comments

@IngoMeyer441
Copy link
Contributor

On Linux (tested it on Debian buster), libclang does only search for system headers in the default system locations but not in clang's own include directory /usr/lib/llvm-6.0/lib/clang/6.0.0/include (the version depends on the installed clang package). This directory for example contains stddef.h, so chromatica currently cannot highlight common types like size_t. A simple workaround for this issue is adding clang's include directory to the global chromatica flags:

let g:chromatica#global_args = ['-isystem/usr/lib/llvm-6.0/lib/clang/6.0.0/include']

On macos, I did not experience such problems. Maybe Apple's libclang got some patches to read all include directories.

In my opinion, that is actually a libclang issue but users of chromatica should know about this (maybe a hint in the README file?). YouCompleteMe, which is also libclang based, brings its own copy of clang headers to avoid this issue. They have a very long issue about libclang search path problems.

@pierremoreau
Copy link
Contributor

Thank you for the tip: I was experiencing the same issue and pulling my hair off trying to figure out what was going on! 🙂

@Iskustvo
Copy link

@IngoHeimbach, thanks a lot for the tip!
After adding

let g:chromatica#global_args = ['-isystem/usr/lib/clang/8.0.0/include']

the syntax highlighting improved a lot. However, Chromatica still doesn't highlight some header names.
For example vector, system_error, cstring and unistd.h in this file are not highlighted.

Is this normal or do I need to do anything else?

I have tried adding every path from

echo | clang -std=c++17 -v -E -x c++ -

with -I in .chromatica but nothing changed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants