clang_File_tryGetRealPathName: on Arch Linux, system header include paths extracted from clang -E -v -xc++ /dev/null have several ../ path components, which confuse clang_getFileName. You'll need clang_File_tryGetRealPathName to correctly resolve paths of system C++ headers.
They require #if CINDEX_VERSION >= 48, while CINDEX_VERSION shipped with clang 6.0.0 is 45.
Here are instructions to build trunk libclang(see https://llvm.org/docs/CMake.html for LLVM cmake options). Note, please use a powerful workstation to build LLVM.
If you want to copy built libclang from workstation to local:
1 2 3 4 5
rsync -a -f '+ lib' -f '+ lib/clang**' -f '+ lib/libclang.*' -f '- *' \ workstation:~/Dev/llvm/static-release/ ~/Dev/llvm/static-release/ # If you want to use trunk clang as the compiler, # ninja -C static-release clang # and add -f '+ bin' -f '+ bin/clang' -f '+ bin/clang++' -f '+ bin/clang-7' on the rsync command line
The libclang headers reside in Dev/llvm/tools/clang while built libraries are in Dev/llvm/static-release. Locate them with CMAKE_PREFIX_PATH.
1 2 3 4 5
cmake -G Ninja -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld \ -DCMAKE_BUILD_TYPE=Release -DCMAKE_EXPORT_COMPILE_COMMANDS=On -DSYSTEM_LIBCLANG=On \ -DCMAKE_PREFIX_PATH="$HOME/Dev/llvm/static-release;$HOME/Dev/llvm/tools/clang" -Brelease -H. cmake --build release # Built release/ccls whose path can be used to set emacs-ccls variable `ccls-executable`