Building FAILURE: scripts/build llvm:host has failed!

  • After entering the one line command "PROJECT=Generic DEVICE=Generic ARCH=x86_64 make image" on a RPi4 4GB with Slackware aarch64 (15) the build gave the following error:

    ninja: build stopped: subcommand failed.
    FAILURE: scripts/build llvm:host during make_host (default)
    *********** FAILED COMMAND ***********
    ninja ${NINJA_OPTS} ${PKG_MAKE_OPTS_HOST}
    **************************************
    FAILURE: scripts/build llvm:host has failed!

    >>> llvm:host seq 230 >>>
    [297/303] [FAIL] build   llvm:host

    The following log for this failure is available:
     /home/john/LibreELEC.tv/build.LibreELEC-Generic.x86_64-12.0-devel/.threads/log
    s/230.log

    Parallel build failure - see log for details. Time of failure: Thu Dec 26 09:57:
    30 CET 2024
    make: *** [Makefile:10: image] Error 1

    A LibreELEC-RPi4.aarch64-12.0 image has been built successfully on the same building machine.

    llvm-18.1.6-aarch64 is available on the building machine. The github cloned LibreELEC is from a couple of days back.

    What could I do to solve this error?

  • Parallel build failures are either a genuine issue with multi-CPU building on a particular package, or sometimes the result of missing dependencies. In the latter case, re-running the build command may result in a new package build-order, and if other packages are now built before the failed package is cleaned/reattempted, it can build correctly. It's not guaranteed, but free to try..

  • I just had the same issue with building llvm on LE 13. When I issue scripts/build llvm directly all 16 threads max out at 100%, all 16GB RAM is used and l swap is 100% and I have to wait for a sig 9 on all threads to use the PC. I will try later the the the link and compile jobs set to 1.

  • I found the failing is related to gcc 14 on ARM,see https://github.com/llvm/llvm-project/issues/78691. I could not apply the presented hack, because some code is missing in llvm 17. Therefore I replaced LibreELEC's llvm 17 source code by llvm 18.1.6. In the latter the hack has already been included.

    Affter many hours the 4GB of RAM and 2 GB of swap on my RPi4 seems not to be sufficient and the system hangs, while my hard disk is still flashing. I could not quit "top" anymore.

    Building LibreELEC for RPi4 on a RPi4 has been successful, building for x86-64 has not been successful.

  • Even with all LINK and COMPILE runs set to 1, it is slower but eventually there is a task that overpowers the CPU until the out of memory sig 9.

    dmesg shows 14 task for llvm-tblgen on 14 threads the time of the crash. Thinking about that I noticed I didn't have llvm installed, and I seem to be able to build this now. It could just be memory too, since upping my swap space also seems to help. 16G + 2G doesn't work but adding 8G of swap seemed to do it.

  • From llvm.org:

    Code
    LLVM_PARALLEL_{COMPILE,LINK}_JOBS:STRING
    
        Building the llvm toolchain can use a lot of resources, particularly linking. These options, when you use the Ninja generator, allow you to restrict the parallelism. For example, to avoid OOMs or going into swap, permit only one link job per 15GB of RAM available on a 32GB machine, specify -G Ninja -DLLVM_PARALLEL_LINK_JOBS=2.
  • As I posted I tried -DLLVM_PARALLEL_LINK_JOBS=1 (in common) and still need `16GB and 8GB swap. Adding -DLLVM_PARALLEL_COMPILE_JOBS=1 didn't making any difference. After adding the swap it worked so I tried the default package it still worked and the memory and swap usage were similar.