This document describes how to compile LLVM distribution and use it to build Kotlin/Native.
Usually, you don't need to compile LLVM by yourself: it is downloaded automatically when you run or build Kotlin/Native compiler.
But if you don't want to download prebuilt LLVM or want to experiment with your own distribution, you come to the right place.
Use package.py script to build LLVM distribution the same way the Kotlin team does.
Change kotlin.native.llvm
Gradle property to the absolute path of the freshly built LLVM distribution.
It's possible to:
-Pkotlin.native.llvm=<path>
when executing Gradle tasks from the command line.It's important to correctly specify llvm version. Look up <version>
in <llvm-distribution>/lib/clang/<version>/include
. kotlin.native.llvm.next.<host>.version
Gradle property is used with llvm distributions provided by kotlin.native.llvm=<path>
.
Now we are ready to build Kotlin/Native itself. The process is described in README.md.
NOTE: In gradle.properties we also have defined special default
and next
LLVM versions. The default
version is the one Kotlin/Native uses, and the next
is there to experiment during migration to another LLVM version.
— Can I override .konan
location?
— Yes, by setting $KONAN_DATA_DIR
environment variable. See HACKING.md.
— Can I use another LLVM distribution without rebuilding Kotlin/Native?
— Yes, see HACKING.md.