libclang gets the system header paths wrong
GitHub issue hawkmoth#262 ("Clang include args still needed on Arch") was found packaging hawkmoth.
Libclang does not calculate the system include paths correctly, trying a pwd-relative path:
> python -c 'import clang.cindex; clang.cindex.Index.create().parse("/dev/null", ["-x", "c", "-E", "-Wp,-v"])'
ignoring nonexistent directory "lib/clang/18/include"
ignoring nonexistent directory "/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/include
End of search list.
Clang itself does fine:
> clang -x c -E -Wp,-v /dev/null
clang -cc1 version 18.1.8 based upon LLVM 18.1.8 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/14.2.1/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/clang/18/include
/usr/local/include
/usr/include
End of search list.
The upstream bug is GitHub issue llvm-project#18150 ("libclang does not get the header search correct").
It seems to work on Debian, but they apply a patch that looks relevant: fix-clang-path-and-build.diff
I'm wondering if we should patch this, too.
Edited by Jan Alexander Steffens (heftig)