[PATCH] Make it easier to bootstrap llvm using cmake

Malea, Daniel daniel.malea at intel.com
Tue Jun 25 11:08:57 PDT 2013


Hi Andy,

Thanks for doing this, it looks pretty reasonable to me. Anything that
helps users build lldb is greatly appreciated :)


Cheers,
Dan

On 2013-06-24 11:20 AM, "Andy Gibbs" <andyg1001 at hotmail.co.uk> wrote:

>Hi,
>
>At the moment it is not very easy to compile a complete
>llvm+clang+lld+lldb+polly toolchain using cmake if your system has a
>C/C++ 
>compiler that is too old or too new.  There has been some discussion
>about 
>bootstrapping on this mailing list, but it is still a complex affair.
>
>The attached patch makes the process a little more straight-forward by
>implementing two simple changes.  It is most likely in lieu of a more
>holistic approach, but perhaps it can be considered as a step in the
>right 
>direction.
>
>The first part of the patch is a change to CMakeLists.txt and
>cmake/config-ix.cmake to enable LLVM_TARGETS_TO_BUILD to understand the
>value "host" like the autotools make system.
>
>The second part is a change to tools/CMakeLists.txt to enable
>LLVM_INCLUDE_TOOLS to be set to "bootstrap-only" to enable clang to be
>included in the build but not lld, lldb or polly.  This is necessary
>since 
>lld, for example, requires -std=c++11 and cmake fails if the host
>compiler 
>doesn't support this.
>
>Following this patch, a bootstrap build can now be done the following way:
>
>$ mkdir bootstrap
>$ cd bootstrap
>$ cmake -G 'Unix Makefiles'
>        -DCMAKE_BUILD_TYPE:STRING=Release
>        -DCMAKE_PREFIX_PATH:STRING=$(pwd)
>        -DLLVM_TARGETS_TO_BUILD:STRING=host
>        -DLLVM_INCLUDE_TOOLS:STRING=bootstrap-only
>        ../source
>$ make clang  # build clang only for host
>
>$ cd ..
>$ export CC=$(realpath bootstrap/bin)/clang
>$ export CXX=$(realpath bootstrap/bin)/clang++
>
>$ mkdir final
>$ cd final
>$ cmake -G 'Unix Makefiles' ../source
>$ make all check-all
>
>The above build doesn't include libc++ or libc++abi, but these are
>relatively straight-forward steps to include inbetween the bootstrap and
>final stages.
>
>Please would someone like to have a look at the patch attached, and let
>me 
>know if it is useful at all, and if I may commit it or not.
>
>Many thanks,
>
>Andy





More information about the llvm-commits mailing list