Clang Python bindings missing from installation ?

Hi Clang experts,

We already use clang to build our code, but would now additionally like to make use of clang’s python bindings to write some custom python scripts to check certain aspects of our C++ code.

Problem is, that my clang/llvm 7.1.0 installations do not contain the necessary files for this. The download of sources for my builds of clang DO contain the necessary files - under <SRC_TOP>/llvm/tools/clang/bindings/python/clang/ I have:

init.py

cindex.py

enumerations.py

but when the build and install steps are done, these files do not get carried over to the installation DESTDIR

I’ve spent a while looking to see whether there is some configuration setting that needs to be done at the cmake level, to get the content copied over from the download location, to the installation. Nothing found. (I see ways to control whether bindings for Go / OCaml should be enabled / disabled, but nothing for Python).

Can one of you please advise what the correct way is to get the bindings included in the installation ? e.g.

  • is there a “-D=” option that I should be passing to cmake ?
  • or should I perhaps be manually updating one of the CMakeLists.txt files somehow ?
  • or should I simply manually copy the above files to somewhere under the installation DESTDIR after the fact ? (If so, is there a recommended location ?)

Thanks a lot for any light you can shed here.

Regards,

Gordon

Python bindings work using libclang (a C library) and a few python source files. Copying the files you identified into your python path (which may depend on your python version) should suffice.

Regards,

Jon