Commit bc13f955 authored by Milian Wolff's avatar Milian Wolff

Also find clang include path based on runtime libclang library path

My KDevelop was compiled against my system libclang v7.0.1, thus
KDEV_CLANG_BUILTIN_DIR points to /usr/lib/clang/7.0.1/include. Now
I compiled clang 8 from sources and put it in a different folder
in my home path and adapted LD_LIBRARY_PATH to make KDevelop pick it
up. This then fails to find the builtin include path, since it tries
to find `/usr/lib/clang/8.0.1/include` which doesn't exit.

This patch adds another fallback to fix the above scneario: We now
lookup the path of libclang at runtime through dlfcn.h's dladdr,
which we pass a libclang function address, here clang_getClangVersion.
Then on success we deduce the include path by removing the library
name and then instead appending `clang/$version/include`, which makes
it use /home/milian/projects/compiled/other/lib/clang/8.0.1/include
as required.
parent c88bf19b
Pipeline #2529 failed with stage
in 60 minutes