could libclang be made a runtime dependency?

Kevin Funk kfunk at
Wed Nov 22 00:24:39 UTC 2017

On Monday, 20 November 2017 15:28:45 CET René J.V. Bertin wrote:
> Hey,
> Out of curiosity, coming back to the dependency on libclang and what made me
> propose a build system mod that allows to build and install the clang
> parser plugin independently from the rest of the IDE:
> Roughly speaking, how many functions from libclang and/or libLLVM are called
> directly by the kdevclangsupport and libKDevClangPrivate?


For the the fun of it:
  ag -G "(\.h|\.cpp)"  -s "clang_\w[\w_]+" plugins/clang -o --no-filename | 
sort | uniq | wc -l

> Would it be
> feasible to do something akin to how Audacity depends on the FFMpeg
> libraries, i.e. load them dynamically from a configurable location and then
> import the required symbols?

Yes, it would be; but it's *way* too much work to change how we use libclang 
at this point in time. It's not something we can do with the current manpower 
-- nor does it really buy us much (besides not crashing the IDE in case 
libclang causes a segfault...).

> I understand that libclang is backwards ABI
> compatible so it's probably possible to build the plugin against, say,
> clang 6 and then use it with any recent enough libclang version provided
> that the plugin keeps track of which functions fail to import?

Yes, libclang (the C interface to Clang to make that clear) has a strong API/
ABI-compat guarantee across version changes.

I'm not sure what you mean with 'the plugin keeps track of which functions 
fail to import'. The point of ABI guarantees in the scenario you mentioned is 
to avoid running into exactly that.

> With such an approach it should be possible for the Mac versions to find and
> use the libclang shipped with Xcode but I think it could also be useful in
> other situations.

You can't really know what version of Clang it was built from, you probably 
can't legally redistribute it (if wanted), and there's no guarantee of ABI 
compatibility across version changes in this particular binary either (it's 
out of your control). Does linking it even work to begin with?

Anyhow. I think that discussion is moot. We'll not help advancing KDevelop on 
macOS by fixing purely hypothetical problems.


> R.

Kevin Funk | kfunk at |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the KDevelop-devel mailing list