meta data for this page

meta-clang

llvm-tblgen oom killed

cmake_do_compile:prepend() {
    # When building lib/Target/*/ there are some .inc files generated
    # by call to `llvm-tblgen`. This very CPU and RAM consuming process
    # so running it with -j 22 triggers oomkiller. Additionally when icecc
    # is used with -j 150 almost 100 processess of `llvm-tblgen` are spawned.
    # Dirty workaroud is below:
    #
    # TODO: can be fixed in CMake files using `JOB_POOLS` feature
    #
    # First try to prebuild some generic cpp files needed by lib/Target
    # at full parallel make:
    cmake_runcmake_build --target clang-tablegen-targets
    cmake_runcmake_build --target lib/CodeGen/install
    cmake_runcmake_build --target lib/Frontend/install
    cmake_runcmake_build --target lib/ExecutionEngine/install
    cmake_runcmake_build --target lib/MC/install
    cmake_runcmake_build --target lib/MCA/install

    # Now run part which involves `llvm-tblgen` with limited resources:
    cmake_runcmake_build --target lib/Target/install -- -l ${@oe.utils.cpu_count()} -j ${@oe.utils.cpu_count() // 2}

    # And finish rest of build process at full speed:
    cmake_runcmake_build --target ${OECMAKE_TARGET_COMPILE}
}

fixed in new version

It is already fixed with new llvm version.

Related issues:

Commit with fix is here:

Usage in local.conf:

local.conf
EXTRA_OECMAKE:append:pn-clang-native = " -DLLVM_PARALLEL_TABLEGEN_JOBS=${@oe.utils.cpu_count() // 2}"
# By default meta-clang is configured to built all architectures, limit it:
LLVM_TARGETS_TO_BUILD = "X86;AArch64"