Yes I did. The problem was coming from the Jack compiler. It was taking too much RAM to compile the files.
Try to limit the RAM it's using by doing the following before building:
export JACK_SERVER_VM_ARGUMENTS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"
Replace the -Xmx4g by the memory you'd like to allocate depending on your current onboard memory.
For example -Xmx2g for 2gb of RAM.