had the same problem a couple of days ago when I tried to install mycroft to my Raspberry PI PC.
As I found out it was because of to low/less memory(RAM) but in your case I wonder a little cause the RPI3 has 2Gb if I'm not wrong compared to my 1GB OPi PC it should work without problems.
But anyways just try to set up a swap partition. I don't know your setup but I would recommend that you install and boot the system over usb and use the free sd card as swap partition. Cause I'm not wrong the USB Ports from the RPi are wired over a USB HUB which is connected to the SoC so there will be 4 Ports pressed trough one tunnel and if you use the sd as swap it should be faster than over a USB Memory Stick.
In my case, cause the OPi PC can't boot from USB so I partitioned the SD Card in 2 parts. One for the boot files and the other partition as 2gb swap space. From there the compiling process worked fine but it took quite long. Around 4h.