As a workaround, try sequential build ("make" instead of "make -j...").
To speed things up, you can build in parallel as much as possible and
then finish with a sequential make ("make -k -j... || make").
> Can I simply disable building the tests?
Tests are not built by default -- you have to run "make check" or
equivalent to build them. However, I am not sure your build fails when
you are building the tests; stubs may be used for non-test tools as
well. The bug report linked above has more information about this mess.