[cfe-dev] Building clang outside of LLVM (with CMake)

Douglas Gregor dgregor at apple.com
Wed Feb 2 10:20:13 PST 2011


On Feb 2, 2011, at 10:10 AM, Óscar Fuentes wrote:

> Douglas Gregor <dgregor at apple.com> writes:
> 
>> We'd like to be able to consider LLVM as a stable library that Clang
>> depends on.
> 
> Okay, that's the idea I had.
> 
>> This would allow us to build against an installed LLVM
>> (rather than embedding our own full copy of LLVM in Clang), test Clang
>> and LLVM more independently,
> 
> No problem with the first part and it is mostly done.

Very cool.

> Testing Clang
> outside of LLVM seems the hard part. AFAIK it is not possible to test
> LLVM once it is installed, and Clang tests are embedded in LLVM's
> testing framework.
> 
> I understand that building Clang standalone is of little benefit if you
> can't test it. Some comment from someone who knows well the testing part
> would be helpful. Dan?

It's mainly the lit-based Clang testing (in clang's "test" subdirectory) that's of interest here, and I think we can just make sure to pick up the lit.ty that is installed with LLVM. There may be a little lit configuration work to do.

>> avoid embedding all of LLVM into the Clang executable (assuming that
>> LLVM becomes a shared library at some point),
> 
> AFAIK it is possible to build Clang as a Huge Single Shared Library with
> the autoconf build and I don't think it would be too difficult to do the
> same with cmake. Right now we can build LLVM as a set of shared
> libraries, which possibly is even better than a huge library. But maybe
> Clang uses LLVM so extensively that it is not interesting to deal with
> multiple libraries instead of just one.


I think the actual packaging as one large shared library vs. several smaller libraries is less important at this point. Just the ability to build against an installed system (and linking against the installed shared libraries, if they're shared) would be a big leap forward.

	- Doug



More information about the cfe-dev mailing list