[cfe-dev] cindex.py & cmake builds of clang

David Röthlisberger david at rothlis.net
Mon May 7 06:06:06 PDT 2012


On 7 May 2012, at 12:30, Arnaud de Grandmaison wrote:
> When building clang using cmake, libclang is actually named
> 'liblibclang' to avoid a file collision on Windows.
> 
> It seems to me the cindex.py should be able to cope with both flavours,
> as it can not know for sure how the libclang library was generated.
> The attached patch teach cindex.py to attempt to load 'liblibclang' in
> case the loading of 'libclang' failed.

I have run into this problem as well: One cannot build libclang on Unix using cmake if one wants to use the libclang python bindings.

I raised bug 12620 where I documented the history of this liblibclang nonsense:
http://llvm.org/bugs/show_bug.cgi?id=12620

A quick summary: For the sake of Windows Visual Studio users, where a library (clang.dll) cannot share the same base name as an executable (clang.exe), the cmake build system was changed to build libclang.dll, which in turn caused the Unix builds to produce liblibclang.so instead of libclang.so.

In response to "Why can't we produce libclang.dll on Windows and libclang.so on Unix?", Óscar Fuentes replied "This is not a technical problem. We know how to implement any of the choices under consideration."
http://clang-developers.42468.n3.nabble.com/Cannot-run-clang-regression-tests-with-cmake-td2961911.html#d1305831334000-246

So it seems that somebody already knows how to fix this, but no further work was done.

I really want the python bindings to work, so I prefer Arnaud's patch over no solution at all; but it feels so filthy to add code to work around defects in the build system, instead of fixing the build system.

David Röthlisberger.





More information about the cfe-dev mailing list