[cfe-dev] building clang outside the LLVM source tree

Sebastian Redl sebastian.redl at getdesigned.at
Sat May 23 07:33:22 PDT 2009


Y Giridhar Appaji Nag wrote:
> Hi,
>
> I intend to build clang packages for Debian.  I understand that clang should
> be built alongside LLVM because clang is a moving target right now, however, I
> intend to build at a 'point-in-time' i.e.  the same version of clang that was
> tagged when LLVM was last released.
>
> I have a few questions:
>
> - Is it possible to build clang outside the LLVM source tree?  i.e. I have a
>   version of LLVM installed somewhere and I would like to use the headers and
>   the libraries that were installed.  My guess is that llvm-config has been
>   provided for doing this.
>
> - To do the above, do I have to craft my own build system?  I poked around and
>   got a feeling that the clang build system depends on a 'source' location of
>   LLVM, and clang is expected to be somewhere in the same source tree as LLVM.
>
>   

If you have an LLVM source tree, it should be possible to put Clang into
its own directory and simply adjust the LEVEL variable in Clang's root
Makefile.

If you don't, it *should* be possible to build Clang by copying
Makefile.common and Makefile.rules to its directory, and generating an
appropriate Makefile.config, then setting LEVEL to the current
directory. Aside from all the things defined in the normal config, it
would also have to set the paths to the compiled tools.

But I'm not 100% sure if that will work.

> These Debian packages are for the Debian 'experimental' distribution (because
> clang hasn't been officially released yet) but a few days after uploading to
> experimental, people using Debian unstable and testing will likely be able to
> use unmodified binary packages.
>
> Also, the current plan is to create the following binary packages from the
> clang source:
>
> clang - will have the driver and other programs
> clang-dev - the headers and static libraries
> clang-doc - the documentation
>
> In a situation like this, I would've ideally created a clang-lib package also
> with shared libraries.  But I intend to do that only when clang is released
> officially.  Please do let me know if this sounds reasonable.
>   
Sounds reasonable to me. I personally have no idea how to create shared
Clang libraries, though.

Sebastian



More information about the cfe-dev mailing list