QtWebEngine uses its own copy of ninja build system. As a general rule, build process parallelized by the ninja as number of cpus available + 2 formula.
So, if you have a system with 12 core and 16 GB of RAM, it is not possible to build QtWebEngine!
Ninja build system tries to run 14 parallel compiler (12+2) and because of the compiling process uses too much memory, it starts to use swap and shortly after your systems becomes completely unresponsive.
You can’t solve this problem running
make -j XX or schedule the
make parent process only a subset of cpus with
taskset or like that because ninja itself always try to find number of available cpus from the system and calculates how many parallel jobs can be made with their own thinking, which is quite bad for us.
Only solution without buying more RAM is disabling some of the cpu cores before the compilation process and enabling them after a while.
For example, if you have a 12 core and 16 GB RAM, you can disable last 6 core with:
$ sudo chcpu --disable 6-11
And start make process which will be execute ninja later. In this setup ninja is going to use total of 8 parallel jobs (6+2). After a while (lets say 30 seconds), you can enable the cpus like below:
$ sudo chcpu --enable 6-11
to continue working while QtWebEngine build running.
Please note that, after making all the cpus available, compilation processes will start to use newly enabled cpus too, but it doesn’t use more than 8 parallel jobs.
You can modify the numbers for your cpu and memory resources.