[llvm-dev] Building an LLVM cross-compiler

Cág via llvm-dev llvm-dev at lists.llvm.org
Fri Nov 6 15:32:28 PST 2020


Hello Chris,

Chris Bieneman wrote:
> You’ve hit on one of the odd historical messes in LLVM. Compiler-RT
> can’t really be treated as a monolithic set of libraries when you are
> bootstrapping. In order to even configure the LLVM sanitizer runtimes
> you need libc and many other OS interfaces, so when bootstrapping you
> need to build the compiler-rt builtins library separately from the
> sanitizers.
> This can be done either by using the `LLVM_ENABLE_RUNTIMES` CMake option
> (see DistributionExample-stage2.cmake in clang/cmake/caches), or by
> treating compiler-rt/lib/builtins as the top-level CMake file.
> 
> I would strongly suggest that you start with one of the CMake cache
> files under clang/cmake/caches as an example because setting up the
> CMake options to build a toolchain that can cross-compile is sadly
> quite complicated.

Thanks for the input.  I will now be trying this cache file to see.  At
the moment I am simply experimenting with different CMake options to see
if I can get it right.  LLVM_ENABLE_RUNTIMES causes the freshly-built
Clang to be used as the compiler for the runtimes set, here it runs into
including host system headers (no libc exists yet).
Only BUILTINS are set to ON, no sanitizers or xrays.

It looks like a quite common request/question.  Has a fix been proposed or
a reviews.llvm.org page exists?  I'd follow it.  Hacking CMake is fun
until you want to get the job done.

Cheers

-- 
caóc


More information about the llvm-dev mailing list