I had a similar problem, it looks like building spidermonkey requires huge amount of RAM, and if you don't have enough of it some build process crash.
If you are building with -jX (with X which works fine for 0ad and the other libraries), you may want to decrease X when running build-source-libs.sh , so there are less simultaneously build processes and maximum RAM usage decrease.