Memory overflow during cmake/ninja build

The above solutions are all great ones. +1 to using ld.gold or LLD if you have them. No matter what though linkers just use a ton of memory! If you have the storage to spare you could increase your swap space.

-Alex