I notice that the AUR compile seems to go quicker.
The thing that happens is for the AUR build process to swap massive amounts of data, grinding the system almost to a halt and finally failing without much of a reason. Nothing typically source code or linkage related.
So an AUR build goes quicker, but swaps a lot, and grinds almost to a halt? By quicker, do you mean it makes quicker progress before the swap-grinding occurs?
Watching `dstat -pcdngsy' would show if many processes are in the run queue, whether it's CPU bound or waiting for I/O, the amount of paging it's doing, and how much swap is used.
Is it possible you haven't disabled the `-j', e.g. `MAKEFLAGS' in /etc/makepkg.conf?