you have around 6GB with swap, make sure there is nothing else consuming
much memory, and that the compilation is not being done in parallel
(i.e. do not use make -j2 or similar).
If you still cannot compile it, you can try using the clang compiler. It
is also available for ubuntu, and it should use only about half as much
ram.I'll try this tonight.