A lot of this functionality is built in

eg. on your ubuntu machine

sudo ./retropie_packages.sh crosscomp setup stretch

then on the rpi3 just install distcc, configure it to use Ubuntu machine.

for building:

PATH="/usr/lib/distcc:$PATH" MAKEFLAGS="-j4 PATH=/usr/lib/distcc:$PATH" ./retropie_packages.sh etc

note settings the PATH for makeflags is needed for some modules to use distcc.

retropie also includes the facility to build raspberry pi binaries on an x86 Ubuntu machine using an emulated chroot and the distcc on the host. see the "builder" module.