Make debug developer takes forever to finish

I am trying to run make debug developer for the first time on Ubuntu 20.04, with an 8th gen i5, 8GB RAM and 21 GB of swap space. It apparently takes forever when it gets to building the tests. Building the rest of the source takes about 35 mins but the tests don’t build fully in over 1.5 hours, before my machine just grinds to a halt and becomes fully unresponsive. I let it remain like that for about half an hour more, before having to forcibly shut down the machine.
How do I solve this problem?

Hello @dmcoder!

That almost sounds like the system is low or totally out of free RAM.
Although you have swap space, normally when almost any intensive operation (like compiling is) hit swap, everything starts to slow down to a crawl. Compiling especially is also using disk so that makes it worse.

Given that most likely you have a 4 cores CPU, this means that make debug developer will try to build with 4 parallel jobs.
You can try to reduce the number of parallel jobs to 2 with make debug developer NPROCS=2; this will obviously slow down the build but it should permit you to finish it at least.
Still keep an eye to memory usage though!

EDIT: Actually there’s quite a variation between cores I see (, quickest way to determine how many parallel jobs it’s using is to run the command nproc and see which number spits out.
As a safe bet I would try to use half of that in NPROCS and, again, look at the memory usage.
Hope this is useful!

It’s a known issue with the tests, T73268 is tracking improvements in this area.

In a more practical sense, generally when i need a debug build, i use it to debug the blender executable, and not the actual tests, so i just temporarily turn off WITH_GTESTS in cmake

Thank you @Smjert and @LazyDodo!
Your advice allowed me to actually get this thing building and work on a bug.