Are you running out of memory?The linking step of a build can use large amounts of memory (>100x more than the final binary size). Running out of RAM often causes a (near-)hang not a crash, even without swap.
To check, try running the compile with a system monitor (e.g. gnome-system-monitor) open.