When I use libclang to parse C file, but I find that libclang will not search clang’s system include directory, e.g., /usr/local/llvm-13.0.0/lib/clang/13.0.0/include, now I have to manually add this directory to parser as following:
tu = index.parse(file, args=['-I', '/usr/local/llvm-13.0.0/lib/clang/13.0.0/include'], and_other_args)
Is there any method that I can add clang’s system include directory to libclang globally?
Just a hunch because I am only familiar with consuming LibTooling things from inside C++ and not Python, but it might be related to RPATH? Generally, if you have a
../lib/clang directory, relative to the path of the running executable, e.g.
bin/clang-something, then it auto-searches there. I would try a symbolic link first.
For example, if I am in
<...>/llvm/bin of a downloaded release, I have
<...>/llvm/lib/clang/14.0.0) containing the intrinsic headers.