f8528c5cca
Provide a stable environment for building LLVM for Linux by using Docker. Note that the base image is Ubuntu 16.04, so after LLVM update building Kotlin/Native on Linux will require glibc 2.23 or higher.
LLVM Build Infrastructure
package.py script automates downloading, building and packing of LLVM distribution used by Kotlin/Native.
Requirements
- Check LLVM requirements. Note that:
- Visual Studio 2017 is required on Windows
- Xcode is required on macOS
- Python 3
- ninja
- git
- CMake
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-pathcreates an archive (zipon Windows,tar.gzon macOS and Linux) with distribution alongside with its SHA256.--install-pathallows overriding distribution's output directory.--num-stagesspecifies 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.--stage0allows 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
- Bootstrap build is not working on macOS for default git branch.
libcxxandcompiler-rtare built as projects, not runtimes.- No way to run LLVM tests out of the box.
- No way to override default
installtask out of the box.