Files
kotlin-fork/kotlin-native/tools/llvm_builder
Sergey Bogolepov 7dda04a1c9 [K/N] Update LLVM distributions to 11.1.0
This commit is important for several reasons:
1. Finally, LLVM update from 8.0.0 to 11.1.0
At the time of writing, LLVM 12.0.0 already came out, but we need to be
compatible with LLVM from Xcode 12.5, so that's why we stick to a bit
older version of LLVM.
2. These LLVM distributions are built with tools/llvm_builder/package.py
We finally managed to introduce an explicit process of building our LLVM
distributions, so we will be able to updated them more frequently and
adapt to our needs.
3. Native Windows LLVM instead of MinGW
Last but not least, we now use native Windows LLVM distribution. While
it might be harder to use (no more posix everywhere), simpler build
process (building msys2 is not that easy) and no need for MinGW-specific
patches makes such distribution way more convenient.
2021-08-03 05:42:00 +00:00
..
2021-07-22 10:44:03 +00:00
2021-07-22 10:44:03 +00:00

LLVM Build Infrastructure

package.py script automates downloading, building and packing of LLVM distribution used by Kotlin/Native.

Requirements

Usage

Just run

python3 package.py

It will create a llvm-distribution folder which contains LLVM distribution.
Note that build will take a lot of time and all your machine cores. 😈
See HACKING.md on how to use freshly built distribution.

Tuning

Run python3 package.py -h to check how one can tune script's behavior. Some examples:

  • --archive-path creates an archive (zip on Windows, tar.gz on macOS and Linux) with distribution alongside with its SHA256.
  • --install-path allows overriding distribution's output directory.
  • --num-stages specifies number of steps in build. Passing 2 or more makes bootstrap build which means that LLVM will build itself by using distribution from the previous step.
  • --stage0 allows using existing LLVM toolchain for bootstrapping.

Docker

You can use Docker to build LLVM for Linux:

docker build -t kotlin-llvm-builder .
docker run --rm -it -v <HOST_PATH>:/output kotlin-llvm-builder --archive-path /output/llvm-11.1.0-linux-x64

Known problems

  1. Bootstrap build is not working on macOS for default git branch.
  2. libcxx and compiler-rt are built as projects, not runtimes.
  3. No way to run LLVM tests out of the box.
  4. No way to override default install task out of the box.