[llvm-dev] Building an LLVM cross-compiler

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Tue Nov 10 07:28:30 PST 2020



> -----Original Message-----
> From: llvm-dev <llvm-dev-bounces at lists.llvm.org> On Behalf Of Cág via
> llvm-dev
> Sent: Tuesday, November 10, 2020 8:49 AM
> To: llvm-dev at lists.llvm.org
> Subject: Re: [llvm-dev] Building an LLVM cross-compiler
> 
> 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.

Can this recipe be documented somewhere in the building-llvm pages?
It's clearly not an obvious procedure.
Thanks,
--paulr

> 
> @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
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://urldefense.com/v3/__https://lists.llvm.org/cgi-
> bin/mailman/listinfo/llvm-dev__;!!JmoZiZGBv3RvKRSx!tLCWq3aafmEQwZlJo-
> mAShbSmokQRv-2IgORiPv3w5i7k1kjD_E0jsNJEWO3Ug-xDw$


More information about the llvm-dev mailing list