“Killed signal” in general means you ran out of memory. You should reduce the parallelism (-j N with N the number of parallel jobs) or make sure you have enough memory (2GB / process may be a reasonable guess).
I don’t see how this can help with the original issue?
I have added most common options you might need, you can it according to your need like you need only clang, -DLLVM_ENABLE_PROJECTS="clang" instead of -DLLVM_ENABLE_PROJECTS="llvm;clang"
If you are installing it in a different host, -DLLVM_TARGETS_TO_BUILD=host_arch instead of -DLLVM_TARGETS_TO_BUILD=X86
With other options, you should get some additional functionalities, but it depends on your need. But double check your storage, it will be a problem if you are running out of space.
You missed -j to the ninja invocation, which is the source of their issue here…
I never use cmake --build, according to the doc: cmake(1) — CMake 3.25.1 Documentation it should support the -j option.
However you can just use ninja directly in place of cmake --build, so ninja -j 1 should work (-j 2 or -j 3 may work just fine as well!).
By default, I believe ninja uses the number of cores you have plus one to compute the number of parallel job,…
I might be wrong but will it be solved after adding -j N to ninja? Because ninja -C build -j 20 means, it will run 20 build commands in parallel in the build directory. Ninja by default runs commands in parallel anyway, so typically I don’t see a need to pass -j.
I also didn’t understand how that would solve the memory issue. Because if he only wants to install llvm then 1-3 GB is enough. If he only wants to install clang, then 1.5 GB is enough, I think. It is possible to install clang, clang-tools-extra, lld, libcxx, libcxxabi, compiler-rt and openmp with only 1.2 GB.