en Choosing a Toolchain - JackA1ltman/NonGKI_Kernel_Build_2nd GitHub Wiki

Choosing a Toolchain

Local Build ยท Step 2

Due to the fragmented history of older kernels, XML and repo tools are generally unavailable (with some exceptions for 5.4/4.19 kernels), which makes toolchain selection more varied and sometimes tricky.

Kernel Version โ‰ค 4.14

Clang (pick one)

  • AOSP Clang 12 (Lineage-20.0 branch): https://github.com/LineageOS/android_prebuilts_clang_kernel_linux-x86_clang-r416183b
  • ZyC Clang 10: https://github.com/ZyCromerZ/Clang/releases/download/10.0.1-20220724-release/Clang-10.0.1-20220724.tar.gz

GCC (Google GCC 4.9, android12L-release branch)

  • ARM64: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9.git
  • ARM: https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9.git

This GCC does not include a compiler binary โ€” it acts mainly as an interpreter/linker helper. Add LD=ld.lld to your build command.

Kernel Version โ‰ฅ 4.19

Clang (recommended)

  • LLVM 22: https://github.com/llvm/llvm-project/releases/download/llvmorg-22.1.2/LLVM-22.1.2-Linux-X64.tar.xz (LLVM 19โ€“22 all work)
  • Clang Neutron 18: https://github.com/Neutron-Toolchains/antman

Build flags: LLVM=1 LLVM_IAS=1

Other Clang Options

  • ZyC Clang: https://github.com/ZyCromerZ/Clang
  • Yuki Clang 18 (18.0.0 branch): https://gitlab.com/TheXPerienceProject/yuki_clang/-/tree/18.0.0
  • AOSP Clang 9โ€“12: https://github.com/Nicklas373/aosp-clang
  • Proton Clang 13โ€“19: https://gitlab.com/LeCmnGend/clang (v13 requires Ubuntu 18.04โ€“20.04)
  • LLVM Clang 11 (master branch): https://github.com/EviraKernel/Clang-11
  • AOSP Clang 10 (10.0 branch): https://github.com/crdroidandroid/android_prebuilts_clang_host_linux-x86_clang-6364210.git

GCC-only Build Options

  • EVA GCC: https://github.com/mvaisakh/gcc-build
  • Linaro GCC (recommended: 4.9 / 7.5): https://releases.linaro.org/components/toolchain/binaries/ Select arm-linux-gnueabi and aarch64-linux-gnu
  • ARM GNU Toolchain (recommended: 9.2): https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads Select arm-none-linux-gnueabihf and aarch64-none-linux-gnu
  • Full Google GCC 4.9 (includes the compiler binary):
    • ARM64 (master branch): https://github.com/KudProject/aarch64-linux-android-4.9.git
    • ARM (main branch): https://github.com/dandelion64-Archives/arm-linux-androideabi-4.9.git

Some 4.19 kernels may also require an older Clang (e.g. Clang 10). It is possible to patch the source to support Clang 20+, but that is an advanced topic.