[llvm-dev] Building an LLVM cross-compiler

Cág via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 10 05:49:02 PST 2020


Hi everyone,

Just a quick update.  Here's what worked for me here*:
1. Get the sources.
2. Build clang, llvm, lld.
3. Install libc headers to a sysroot.
4. Build compiler-rt builtins and crt with the freshly-built clang.
One need to set C_COMPILER_WORKS to skip the checks.
5. Build libc.a/libc.so

Now the freshly-built clang can compile a "Hello, World" program.

@Martin Storsjö
@Chris Bieneman
Thanks for the hints!


* - instead of previously supposed
  1. Get the sources (llvm, lld, compiler-rt, libunwind, libcxx...).
  2. Build an LLVM cross-compiler toolchain using native distribution's
  compiler (i.e. build an x86_64 clang executable that targets aarch64).
  3. Cross-compile libc and other libraries/dependencies to run the
  userland.
  4. Cross-compile the userland.

-- 
caóc


More information about the llvm-dev mailing list